Skip to content

Commit 127595e

Browse files
committed
ci: check Cargo version against Git tag in release.yml (#16657)
1 parent 82521c9 commit 127595e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.github/workflows/release.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,22 @@ jobs:
4343
outputs:
4444
VERSION: ${{ steps.extract_version.outputs.VERSION }}
4545

46+
check-version:
47+
name: check version
48+
runs-on: ubuntu-latest
49+
needs: extract-version
50+
steps:
51+
- uses: actions/checkout@v4
52+
- uses: dtolnay/rust-toolchain@stable
53+
- name: Verify crate version matches tag
54+
# Check that the Cargo version starts with the tag,
55+
# so that Cargo version 1.4.8 can be matched against both v1.4.8 and v1.4.8-rc.1
56+
run: |
57+
tag="${{ needs.extract-version.outputs.VERSION }}"
58+
tag=${tag#v}
59+
cargo_ver=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
60+
[[ "$tag" == "$cargo_ver"* ]] || { echo "Tag $tag doesn’t match the Cargo version $cargo_ver"; exit 1; }
61+
4662
build:
4763
name: build release
4864
runs-on: ${{ matrix.configs.os }}

0 commit comments

Comments
 (0)