Skip to content

Commit c0652f6

Browse files
authored
chore: release push check against Cargo.toml (GreptimeTeam#7426)
Signed-off-by: discord9 <discord9@163.com>
1 parent fed6cb0 commit c0652f6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

.github/scripts/create-version.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff 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")"

0 commit comments

Comments
 (0)