Skip to content

Commit 64592eb

Browse files
committed
refactor: new CI/CD strategy
1 parent d372452 commit 64592eb

File tree

6 files changed

+36
-40
lines changed

6 files changed

+36
-40
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ version: 2
55
updates:
66
- package-ecosystem: "cargo"
77
directory: "/"
8-
target-branch: development
8+
target-branch: main
99
schedule:
1010
interval: "daily"

.github/workflows/build_and_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Build and test
22
on:
33
pull_request:
4-
branches: [development, release]
4+
branches: [main]
55
jobs:
66
build_and_test:
77
name: Build and test

.github/workflows/check_version_bump.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/deploy_prerelease.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Publish pre-release
22
on:
33
push:
4-
branches: [development]
4+
branches: [main]
55
jobs:
66
github:
77
name: Publish GitHub
@@ -35,4 +35,4 @@ jobs:
3535
- name: Create release
3636
env:
3737
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub Actions
38-
run: gh release create "${{ steps.commit_hash.outputs.commit_hash }}" --repo="$GITHUB_REPOSITORY" --target development --title="Pre-Release ${{ steps.commit_hash.outputs.commit_hash }} (${{ steps.version.outputs.version }})" --generate-notes --prerelease "./target/package/${{ steps.crate_name.outputs.crate_name }}-${{ steps.version.outputs.version }}.crate"
38+
run: gh release create "${{ steps.commit_hash.outputs.commit_hash }}" --repo="$GITHUB_REPOSITORY" --target main --title="Pre-Release ${{ steps.commit_hash.outputs.commit_hash }} (${{ steps.version.outputs.version }})" --generate-notes --prerelease "./target/package/${{ steps.crate_name.outputs.crate_name }}-${{ steps.version.outputs.version }}.crate"

.github/workflows/deploy_release.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,40 @@
11
name: Publish release
22
on:
33
push:
4-
branches: [release]
4+
branches: [release/**]
55
jobs:
6+
check_version_bump:
7+
name: Check version bump
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Setup Rust toolchain stable-x86_64-unknown-linux-gnu for ubuntu-latest
13+
uses: actions-rs/toolchain@v1
14+
with:
15+
toolchain: stable-x86_64-unknown-linux-gnu
16+
override: true
17+
- name: Read source branch version
18+
id: source_version
19+
run: echo "version=$(cargo read-manifest | jq -r .version)" >> $GITHUB_OUTPUT
20+
- name: Update cargo index
21+
run: cargo search
22+
- name: Read crates.io version
23+
id: crates_io_version
24+
run: echo "version=$(cargo search --limit 1 lum | grep -oP '"\K[0-9]+\\.[0-9]+\\.[0-9]+')" >> $GITHUB_OUTPUT
25+
- name: Parse and compare versions
26+
run: |
27+
source_version="${{ steps.source_version.outputs.version }}"
28+
crates_io_version="${{ steps.crates_io_version.outputs.version }}"
29+
if [ "$(printf '%s\n' "$crates_io_version" "$source_version" | sort -V | head -n1)" != "$source_version" ]; then
30+
echo "Source branch version ($source_version) is higher than crates.io version ($crates_io_version)."
31+
else
32+
echo "Source branch version ($source_version) is not higher than crates.io version ($crates_io_version)."
33+
exit 1
34+
fi
635
crates_io:
736
name: Publish crates.io
37+
needs: check_version_bump
838
runs-on: ubuntu-latest
939
steps:
1040
- name: Checkout

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="center">
2-
<img src="https://raw.githubusercontent.com/Kitt3120/lum/development/.github/assets/portrait.png" width="512">
2+
<img src="https://raw.githubusercontent.com/Kitt3120/lum/main/.github/assets/portrait.png" width="512">
33
</p>
44

55
# lum

0 commit comments

Comments
 (0)