Skip to content

Commit ab06543

Browse files
committed
add release tag version check
1 parent 2b9be33 commit ab06543

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,31 @@ on:
66
- 'v*'
77

88
jobs:
9+
version-check:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Read version from Cargo.toml
16+
id: cargo_version
17+
uses: SebRollen/toml-action@v1.2.0
18+
with:
19+
file: Cargo.toml
20+
field: package.version
21+
22+
- name: Fail if tag does not match Cargo.toml version
23+
run: |
24+
expected="v${{ steps.cargo_version.outputs.value }}"
25+
actual="${{ github.ref_name }}"
26+
[ "$expected" = "$actual" ] || {
27+
echo "Version mismatch: release tag '$actual' does not match cargo.toml version '$expected'."
28+
exit 1
29+
}
30+
931
build-linux:
1032
name: Build Linux Binary
33+
needs: [version-check]
1134
runs-on: ubuntu-latest
1235
steps:
1336
- name: Checkout code
@@ -30,6 +53,7 @@ jobs:
3053

3154
build-macos:
3255
name: Build macOS Binary
56+
needs: [version-check]
3357
runs-on: macos-latest
3458
steps:
3559
- name: Checkout code
@@ -52,6 +76,7 @@ jobs:
5276

5377
build-windows:
5478
name: Build Windows Binary
79+
needs: [version-check]
5580
runs-on: windows-latest
5681
steps:
5782
- name: Checkout code

0 commit comments

Comments
 (0)