Skip to content

Commit f863dd7

Browse files
authored
Add check-release-version job (#18)
1 parent 8ea79c9 commit f863dd7

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

‎.github/workflows/CI.yml‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ permissions:
1414
contents: read
1515

1616
jobs:
17+
check-release-version:
18+
if: "startsWith(github.ref, 'refs/tags/')"
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v6
22+
- name: Verify tag matches package versions
23+
run: |
24+
TAG="${GITHUB_REF_NAME#v}"
25+
CARGO_VERSION="$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -n1)"
26+
PYPROJECT_VERSION="$(sed -n 's/^version = "\(.*\)"$/\1/p' pyproject.toml | head -n1)"
27+
test "$TAG" = "$CARGO_VERSION"
28+
test "$TAG" = "$PYPROJECT_VERSION"
1729
test:
1830
strategy:
1931
matrix:
@@ -43,7 +55,7 @@ jobs:
4355
4456
pack-sdist:
4557
if: "startsWith(github.ref, 'refs/tags/')"
46-
needs: [ test ]
58+
needs: [ check-release-version, test ]
4759
runs-on: ubuntu-latest
4860
steps:
4961
- uses: actions/checkout@v6
@@ -62,7 +74,7 @@ jobs:
6274

6375
pack-linux:
6476
if: "startsWith(github.ref, 'refs/tags/')"
65-
needs: [ test ]
77+
needs: [ check-release-version, test ]
6678
runs-on: ubuntu-latest
6779
strategy:
6880
matrix:
@@ -87,7 +99,7 @@ jobs:
8799

88100
pack-windows:
89101
if: "startsWith(github.ref, 'refs/tags/')"
90-
needs: [ test ]
102+
needs: [ check-release-version, test ]
91103
runs-on: windows-latest
92104
strategy:
93105
matrix:
@@ -112,7 +124,7 @@ jobs:
112124

113125
pack-macos:
114126
if: "startsWith(github.ref, 'refs/tags/')"
115-
needs: [ test ]
127+
needs: [ check-release-version, test ]
116128
runs-on: macos-latest
117129
strategy:
118130
matrix:
@@ -136,7 +148,7 @@ jobs:
136148
release:
137149
name: Release
138150
if: "startsWith(github.ref, 'refs/tags/')"
139-
needs: [ pack-sdist, pack-linux, pack-windows, pack-macos ]
151+
needs: [ check-release-version, pack-sdist, pack-linux, pack-windows, pack-macos ]
140152
permissions:
141153
contents: read
142154
id-token: write

0 commit comments

Comments
 (0)