Skip to content

Commit 9415357

Browse files
author
Feiyang Liu
committed
automatically create tag when release workflow triggered
1 parent 5f0b7b2 commit 9415357

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

.github/workflows/release.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
with:
2828
fetch-depth: 0
2929

30-
- name: Validate versions and tag
30+
- name: Validate versions and create tag
3131
run: |
3232
if ! echo "$CODE_EDITOR_VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$'; then
3333
echo "Code Editor version $CODE_EDITOR_VERSION does not follow semantic version pattern (x.y.z) or x.y.z-rc.N. Skipping release."
@@ -36,10 +36,13 @@ jobs:
3636
echo "Code Editor version $CODE_EDITOR_VERSION is valid"
3737
echo "SageMaker Code Editor version $SAGEMAKER_VERSION will be mapped"
3838
39-
# Verify tag exists and matches the version
40-
if ! git rev-parse "$CODE_EDITOR_VERSION" >/dev/null 2>&1; then
41-
echo "Error: Tag $CODE_EDITOR_VERSION does not exist. Create it first with: git tag $CODE_EDITOR_VERSION. Skipping release."
42-
exit 1
39+
# Check if tag already exists
40+
if git rev-parse "$CODE_EDITOR_VERSION" >/dev/null 2>&1; then
41+
echo "Tag $CODE_EDITOR_VERSION already exists"
42+
else
43+
echo "Creating tag $CODE_EDITOR_VERSION on current commit"
44+
git tag "$CODE_EDITOR_VERSION"
45+
git push origin "$CODE_EDITOR_VERSION"
4346
fi
4447
4548
# Get commit SHA from tag and export it

0 commit comments

Comments
 (0)