Skip to content

Commit d241c9e

Browse files
authored
Merge pull request #1102 from viccuad/main
ci: Add version-check job to check Cargo.toml on release
2 parents 80ebc71 + 3018330 commit d241c9e

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.github/workflows/ci.yml

+17-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,23 @@ jobs:
2323
with:
2424
command: check
2525

26+
version-check:
27+
name: Check Cargo.toml version
28+
if: github.ref_type == 'tag'
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Download source code
32+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33+
- name: Check cargo file version
34+
run: |
35+
CARGO_VERSION=$(sed -n 's,^version\s*= \"\(.*\)\",\1,p' Cargo.toml)
36+
TAG_VERSION=$(echo ${{ github.ref_name }} | sed 's/v//')
37+
38+
if [ "$CARGO_VERSION" != "$TAG_VERSION" ];then
39+
echo "::error title=Invalid Cargo.toml version::Cargo.toml version does not match the tag version"
40+
exit 1
41+
fi
42+
2643
unit-tests:
2744
name: Unit tests
2845
runs-on: ubuntu-latest
@@ -132,4 +149,3 @@ jobs:
132149
echo "Changes detected in cli-docs.md. Please run `make build-docs` and commit the changes."
133150
gh run cancel ${{ github.run_id }}
134151
fi
135-

0 commit comments

Comments
 (0)