File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,17 @@ function create_version() {
4949 echo " GITHUB_REF_NAME is empty in push event" >&2
5050 exit 1
5151 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+
5263 echo " $GITHUB_REF_NAME "
5364 elif [ " $GITHUB_EVENT_NAME " = workflow_dispatch ]; then
5465 echo " $NEXT_RELEASE_VERSION -$( git rev-parse --short HEAD) -$( date " +%Y%m%d-%s" ) "
You can’t perform that action at this time.
0 commit comments