11name : Create release
22on :
3- push :
4- tags :
5- - ' *'
3+ workflow_dispatch :
4+ inputs :
5+ code_editor_version :
6+ description : ' Code Editor version'
7+ required : true
8+ type : string
9+ sagemaker_version :
10+ description : ' SageMaker Code Editor version'
11+ required : true
12+ type : string
613
714jobs :
815 release :
1118 contents : write # Required for creating releases
1219 env :
1320 COMMIT_SHA : ${{ github.sha }}
14- VERSION_NUM : ${{ github.event.inputs.version || github.ref_name }}
21+ CODE_EDITOR_VERSION : ${{ github.event.inputs.code_editor_version }}
22+ SAGEMAKER_VERSION : ${{ github.event.inputs.sagemaker_version }}
1523 SAGEMAKER_ARTIFACT_PREFIX : " code-editor-sagemaker-server"
1624 GH_TOKEN : ${{ github.token }}
1725 steps :
@@ -20,22 +28,28 @@ jobs:
2028 with :
2129 fetch-depth : 0
2230
23- - name : Validate tag
31+ - name : Validate versions and tag
2432 run : |
25- if ! echo "$VERSION_NUM " | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$'; then
26- echo "Tag $VERSION_NUM does not follow semantic version pattern (x.y.z or x.y.z-rc.N) . Skipping release."
27- exit 78 # neutral exit code
33+ if ! echo "$CODE_EDITOR_VERSION " | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$'; then
34+ echo "Code Editor version $CODE_EDITOR_VERSION does not follow semantic version pattern (x.y.z) or x.y.z-rc.N. Skipping release."
35+ exit 1
2836 fi
29- echo "Tag $VERSION_NUM follows valid semantic version pattern"
30-
31- # Verify release tag is made on the correct major.minor version branch.
32- MAJOR_MINOR=$(echo "$VERSION_NUM" | cut -d'.' -f1,2)
33- BRANCH_CONTAINS_OUTPUT=$(git branch --remote --contains "$COMMIT_SHA" "origin/$MAJOR_MINOR")
34- if [ -z "$BRANCH_CONTAINS_OUTPUT" ]; then
35- echo "Tag $VERSION_NUM is not on the correct branch. Skipping release."
36- exit 78
37+ echo "Code Editor version $CODE_EDITOR_VERSION is valid"
38+ echo "SageMaker Code Editor version $SAGEMAKER_VERSION will be mapped"
39+
40+ # Verify tag exists and matches the version
41+ if ! git rev-parse "$CODE_EDITOR_VERSION" >/dev/null 2>&1; then
42+ echo "Error: Tag $CODE_EDITOR_VERSION does not exist. Create it first with: git tag $CODE_EDITOR_VERSION. Skipping release."
43+ exit 1
44+ fi
45+
46+ # Verify tag is on correct branch
47+ MAJOR_MINOR=$(echo "$CODE_EDITOR_VERSION" | cut -d'.' -f1,2)
48+ if ! git branch --remote --contains "$CODE_EDITOR_VERSION" | grep -q "origin/$MAJOR_MINOR"; then
49+ echo "Error: Tag $CODE_EDITOR_VERSION is not on branch $MAJOR_MINOR. Skipping release."
50+ exit 1
3751 fi
38- echo "Tag is from a valid branch. "
52+ echo "Tag validation passed "
3953
4054 - name : Download sagemaker artifacts by commit ID
4155 run : |
@@ -58,21 +72,20 @@ jobs:
5872 fi
5973 done
6074
61- - name : Update Code Editor version
75+ - name : Update versions in artifacts
6276 run : |
6377 tar xzf "$COMMIT_SHA-$SAGEMAKER_ARTIFACT_PREFIX-src/$SAGEMAKER_ARTIFACT_PREFIX-src.tar.gz"
6478 cd code-editor-src
65- CURRENT_VERSION =$(jq -r '.codeEditorVersion' product.json)
66- jq ".codeEditorVersion = \"$VERSION_NUM \"" product.json > temp.json && mv temp.json product.json
79+ CURRENT_CE_VERSION =$(jq -r '.codeEditorVersion' product.json)
80+ jq ".codeEditorVersion = \"$CODE_EDITOR_VERSION\" | .sagemakerCodeEditorVersion = \"$SAGEMAKER_VERSION \"" product.json > temp.json && mv temp.json product.json
6781 cd ..
68- tar -czf "code-editor-sagemaker-src-$VERSION_NUM .tar.gz" code-editor-src/
82+ tar -czf "code-editor-sagemaker-src-$CODE_EDITOR_VERSION .tar.gz" code-editor-src/
6983 rm -rf code-editor-src
7084
7185 tar xzf "$COMMIT_SHA-$SAGEMAKER_ARTIFACT_PREFIX-build/$SAGEMAKER_ARTIFACT_PREFIX-build.tar.gz"
7286 cd vscode-reh-web-linux-x64
7387
74- # Update Code Editor Version in all files
75- jq ".codeEditorVersion = \"$VERSION_NUM\"" product.json > temp.json && mv temp.json product.json
88+ jq ".codeEditorVersion = \"$CODE_EDITOR_VERSION\" | .sagemakerCodeEditorVersion = \"$SAGEMAKER_VERSION\"" product.json > temp.json && mv temp.json product.json
7689
7790 FILES_TO_UPDATE=(
7891 "out/server-main.js"
@@ -81,31 +94,31 @@ jobs:
8194 "out/vs/workbench/api/node/extensionHostProcess.js"
8295 )
8396 for file in "${FILES_TO_UPDATE[@]}"; do
84- sed -i "s/codeEditorVersion:\s*\"$CURRENT_VERSION \"/codeEditorVersion:\"$VERSION_NUM \"/g" "$file"
97+ sed -i "s/codeEditorVersion:\"$CURRENT_CE_VERSION \"/codeEditorVersion:\"$CODE_EDITOR_VERSION\",sagemakerCodeEditorVersion:\"$SAGEMAKER_VERSION \"/g" "$file"
8598 done
8699
87100 cd ..
88- tar -czf "code-editor-sagemaker-server-$VERSION_NUM .tar.gz" vscode-reh-web-linux-x64/
101+ tar -czf "code-editor-sagemaker-server-$CODE_EDITOR_VERSION .tar.gz" vscode-reh-web-linux-x64/
89102 rm -rf vscode-reh-web-linux-x64
90103
91104 - name : Create GitHub release
92105 run : |
93106 # Check if this is a release candidate
94107 PRERELEASE_FLAG=""
95- if echo "$VERSION_NUM " | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$'; then
108+ if echo "$CODE_EDITOR_VERSION " | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$'; then
96109 PRERELEASE_FLAG="--prerelease"
97110 echo "Detected release candidate version, will mark as prerelease"
98111 fi
99112
100113 # Check if release already exists. Needed when release created via new release in guthub ui
101- if gh release view "$VERSION_NUM " > /dev/null 2>&1; then
102- echo "Release for tag $VERSION_NUM already exists, uploading additional assets..."
103- gh release upload "$VERSION_NUM " ./*.tar.gz --clobber
114+ if gh release view "$CODE_EDITOR_VERSION " > /dev/null 2>&1; then
115+ echo "Release for tag $CODE_EDITOR_VERSION already exists, uploading additional assets..."
116+ gh release upload "$CODE_EDITOR_VERSION " ./*.tar.gz --clobber
104117 else
105- echo "Creating new release for tag $VERSION_NUM ..."
106- gh release create "$VERSION_NUM " ./*.tar.gz \
107- --title "Release $VERSION_NUM " \
108- --notes "Release $VERSION_NUM " \
118+ echo "Creating new release for tag $CODE_EDITOR_VERSION ..."
119+ gh release create "$CODE_EDITOR_VERSION " ./*.tar.gz \
120+ --title "Release $CODE_EDITOR_VERSION " \
121+ --notes "Release $CODE_EDITOR_VERSION\n\nSageMaker Code Editor Version: $SAGEMAKER_VERSION " \
109122 $PRERELEASE_FLAG
110123 fi
111124 handle-failures :
0 commit comments