feat: enhance version validation in CI workflow to ensure tag consistency with Cargo.toml
CI / Windows x64 (push) Failing after 9m7s
CI / Windows x64 (push) Failing after 9m7s
This commit is contained in:
+16
-2
@@ -61,10 +61,24 @@ jobs:
|
|||||||
id: meta
|
id: meta
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
|
manifest=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)
|
||||||
|
version="$manifest"
|
||||||
|
|
||||||
|
# A tag that disagrees with Cargo.toml must never ship. The installer
|
||||||
|
# is named after the tag, but the binary reports env!("CARGO_PKG_VERSION")
|
||||||
|
# — so a mismatch leaves every installed copy seeing the release as
|
||||||
|
# newer than itself forever, reinstalling every few hours.
|
||||||
case "$GITHUB_REF" in
|
case "$GITHUB_REF" in
|
||||||
refs/tags/v*) version="${GITHUB_REF#refs/tags/v}" ;;
|
refs/tags/v*)
|
||||||
*) version=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2) ;;
|
version="${GITHUB_REF#refs/tags/v}"
|
||||||
|
if [ "$version" != "$manifest" ]; then
|
||||||
|
echo "tag v$version does not match Cargo.toml version $manifest" >&2
|
||||||
|
echo "bump the version in Cargo.toml and retag" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||||
echo "version: $version"
|
echo "version: $version"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user