We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fed6cb0 commit c0652f6Copy full SHA for c0652f6
1 file changed
.github/scripts/create-version.sh
@@ -49,6 +49,17 @@ function create_version() {
49
echo "GITHUB_REF_NAME is empty in push event" >&2
50
exit 1
51
fi
52
+
53
+ # For tag releases, ensure GITHUB_REF_NAME matches the version in Cargo.toml
54
+ CARGO_VERSION=$(grep '^version = ' Cargo.toml | cut -d '"' -f 2 | head -n 1)
55
+ EXPECTED_REF_NAME="v${CARGO_VERSION}"
56
57
+ if [ "$GITHUB_REF_NAME" != "$EXPECTED_REF_NAME" ]; then
58
+ echo "Error: GITHUB_REF_NAME '$GITHUB_REF_NAME' does not match Cargo.toml version 'v${CARGO_VERSION}'" >&2
59
+ echo "Expected tag name: '$EXPECTED_REF_NAME'" >&2
60
+ exit 1
61
+ fi
62
63
echo "$GITHUB_REF_NAME"
64
elif [ "$GITHUB_EVENT_NAME" = workflow_dispatch ]; then
65
echo "$NEXT_RELEASE_VERSION-$(git rev-parse --short HEAD)-$(date "+%Y%m%d-%s")"
0 commit comments