Skip to content

Commit 8846358

Browse files
author
Feiyang Liu
committed
test
1 parent a92485e commit 8846358

File tree

1 file changed

+31
-19
lines changed

1 file changed

+31
-19
lines changed

.github/workflows/release.yaml

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
description: 'SageMaker Code Editor version'
1111
required: true
1212
type: string
13+
commit_sha:
14+
description: 'Commit SHA (optional, for testing with specific artifacts)'
15+
required: false
16+
type: string
1317

1418
jobs:
1519
release:
@@ -28,6 +32,8 @@ jobs:
2832
fetch-depth: 0
2933

3034
- name: Validate versions and create tag
35+
env:
36+
MANUAL_COMMIT_SHA: ${{ github.event.inputs.commit_sha }}
3137
run: |
3238
if ! echo "$CODE_EDITOR_VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$'; then
3339
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,27 +42,33 @@ jobs:
3642
echo "Code Editor version $CODE_EDITOR_VERSION is valid"
3743
echo "SageMaker Code Editor version $SAGEMAKER_VERSION will be mapped"
3844
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"
45+
# Use manual commit SHA if provided (for testing)
46+
if [ -n "$MANUAL_COMMIT_SHA" ]; then
47+
echo "Using manually provided commit SHA: $MANUAL_COMMIT_SHA"
48+
echo "COMMIT_SHA=$MANUAL_COMMIT_SHA" >> $GITHUB_ENV
4249
else
43-
echo "Creating tag $CODE_EDITOR_VERSION on current commit"
44-
git tag "$CODE_EDITOR_VERSION"
45-
git push origin "$CODE_EDITOR_VERSION"
46-
fi
47-
48-
# Get commit SHA from tag and export it
49-
TAG_COMMIT_SHA=$(git rev-parse "$CODE_EDITOR_VERSION")
50-
echo "COMMIT_SHA=$TAG_COMMIT_SHA" >> $GITHUB_ENV
51-
echo "Tag $CODE_EDITOR_VERSION points to commit $TAG_COMMIT_SHA"
52-
53-
# Verify tag is on correct branch
54-
MAJOR_MINOR=$(echo "$CODE_EDITOR_VERSION" | cut -d'.' -f1,2)
55-
if ! git branch --remote --contains "$CODE_EDITOR_VERSION" | grep -q "origin/$MAJOR_MINOR"; then
56-
echo "Error: Tag $CODE_EDITOR_VERSION is not on branch $MAJOR_MINOR. Skipping release."
57-
exit 1
50+
# Check if tag already exists
51+
if git rev-parse "$CODE_EDITOR_VERSION" >/dev/null 2>&1; then
52+
echo "Tag $CODE_EDITOR_VERSION already exists"
53+
else
54+
echo "Creating tag $CODE_EDITOR_VERSION on current commit"
55+
git tag "$CODE_EDITOR_VERSION"
56+
git push origin "$CODE_EDITOR_VERSION"
57+
fi
58+
59+
# Get commit SHA from tag and export it
60+
TAG_COMMIT_SHA=$(git rev-parse "$CODE_EDITOR_VERSION")
61+
echo "COMMIT_SHA=$TAG_COMMIT_SHA" >> $GITHUB_ENV
62+
echo "Tag $CODE_EDITOR_VERSION points to commit $TAG_COMMIT_SHA"
63+
64+
# Verify tag is on correct branch
65+
MAJOR_MINOR=$(echo "$CODE_EDITOR_VERSION" | cut -d'.' -f1,2)
66+
if ! git branch --remote --contains "$CODE_EDITOR_VERSION" | grep -q "origin/$MAJOR_MINOR"; then
67+
echo "Error: Tag $CODE_EDITOR_VERSION is not on branch $MAJOR_MINOR. Skipping release."
68+
exit 1
69+
fi
70+
echo "Tag validation passed"
5871
fi
59-
echo "Tag validation passed"
6072
6173
- name: Download sagemaker artifacts by commit ID
6274
run: |

0 commit comments

Comments
 (0)