Skip to content

Commit 3708aa8

Browse files
Add SageMaker Code Editor version mapping to release workflow (#103)
1 parent 81a0b57 commit 3708aa8

File tree

4 files changed

+119
-48
lines changed

4 files changed

+119
-48
lines changed

.github/workflows/release.yaml

Lines changed: 58 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
name: Create release
22
on:
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

714
jobs:
815
release:
916
runs-on: ubuntu-latest
1017
permissions:
1118
contents: write # Required for creating releases
1219
env:
13-
COMMIT_SHA: ${{ github.sha }}
14-
VERSION_NUM: ${{ github.event.inputs.version || github.ref_name }}
20+
CODE_EDITOR_VERSION: ${{ github.event.inputs.code_editor_version }}
21+
SAGEMAKER_VERSION: ${{ github.event.inputs.sagemaker_version }}
1522
SAGEMAKER_ARTIFACT_PREFIX: "code-editor-sagemaker-server"
1623
GH_TOKEN: ${{ github.token }}
1724
steps:
@@ -20,22 +27,36 @@ jobs:
2027
with:
2128
fetch-depth: 0
2229

23-
- name: Validate tag
30+
- name: Validate versions and create tag
2431
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
32+
if ! echo "$CODE_EDITOR_VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?$'; then
33+
echo "Code Editor version $CODE_EDITOR_VERSION does not follow semantic version pattern (x.y.z) or x.y.z-rc.N. Skipping release."
34+
exit 1
2835
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
36+
echo "Code Editor version $CODE_EDITOR_VERSION is valid"
37+
echo "SageMaker Code Editor version $SAGEMAKER_VERSION will be mapped"
38+
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"
3746
fi
38-
echo "Tag is from a valid branch."
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
58+
fi
59+
echo "Tag validation passed"
3960
4061
- name: Download sagemaker artifacts by commit ID
4162
run: |
@@ -58,21 +79,21 @@ jobs:
5879
fi
5980
done
6081
61-
- name: Update Code Editor version
82+
- name: Update versions in artifacts
6283
run: |
6384
tar xzf "$COMMIT_SHA-$SAGEMAKER_ARTIFACT_PREFIX-src/$SAGEMAKER_ARTIFACT_PREFIX-src.tar.gz"
6485
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
86+
CURRENT_CE_VERSION=$(jq -r '.codeEditorVersion' product.json)
87+
jq ".codeEditorVersion = \"$CODE_EDITOR_VERSION\" | .sagemakerCodeEditorVersion = \"$SAGEMAKER_VERSION\"" product.json > temp.json && mv temp.json product.json
6788
cd ..
68-
tar -czf "code-editor-sagemaker-src-$VERSION_NUM.tar.gz" code-editor-src/
89+
tar -czf "code-editor-sagemaker-src-$CODE_EDITOR_VERSION.tar.gz" code-editor-src/
6990
rm -rf code-editor-src
7091
7192
tar xzf "$COMMIT_SHA-$SAGEMAKER_ARTIFACT_PREFIX-build/$SAGEMAKER_ARTIFACT_PREFIX-build.tar.gz"
7293
cd vscode-reh-web-linux-x64
7394
74-
# Update Code Editor Version in all files
75-
jq ".codeEditorVersion = \"$VERSION_NUM\"" product.json > temp.json && mv temp.json product.json
95+
CURRENT_SM_VERSION=$(jq -r '.sagemakerCodeEditorVersion' product.json)
96+
jq ".codeEditorVersion = \"$CODE_EDITOR_VERSION\" | .sagemakerCodeEditorVersion = \"$SAGEMAKER_VERSION\"" product.json > temp.json && mv temp.json product.json
7697
7798
FILES_TO_UPDATE=(
7899
"out/server-main.js"
@@ -81,31 +102,34 @@ jobs:
81102
"out/vs/workbench/api/node/extensionHostProcess.js"
82103
)
83104
for file in "${FILES_TO_UPDATE[@]}"; do
84-
sed -i "s/codeEditorVersion:\s*\"$CURRENT_VERSION\"/codeEditorVersion:\"$VERSION_NUM\"/g" "$file"
105+
sed -i "s/codeEditorVersion:\s*\"$CURRENT_CE_VERSION\"/codeEditorVersion:\"$CODE_EDITOR_VERSION\"/g" "$file"
106+
sed -i "s/sagemakerCodeEditorVersion:\s*\"$CURRENT_SM_VERSION\"/sagemakerCodeEditorVersion:\"$SAGEMAKER_VERSION\"/g" "$file"
85107
done
86108
87109
cd ..
88-
tar -czf "code-editor-sagemaker-server-$VERSION_NUM.tar.gz" vscode-reh-web-linux-x64/
110+
tar -czf "code-editor-sagemaker-server-$CODE_EDITOR_VERSION.tar.gz" vscode-reh-web-linux-x64/
89111
rm -rf vscode-reh-web-linux-x64
90112
91113
- name: Create GitHub release
92114
run: |
93115
# Check if this is a release candidate
94116
PRERELEASE_FLAG=""
95-
if echo "$VERSION_NUM" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$'; then
117+
if echo "$CODE_EDITOR_VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$'; then
96118
PRERELEASE_FLAG="--prerelease"
97119
echo "Detected release candidate version, will mark as prerelease"
98120
fi
99121
100122
# 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
123+
if gh release view "$CODE_EDITOR_VERSION" > /dev/null 2>&1; then
124+
echo "Release for tag $CODE_EDITOR_VERSION already exists, uploading additional assets..."
125+
gh release upload "$CODE_EDITOR_VERSION" ./*.tar.gz --clobber
104126
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" \
127+
echo "Creating new release for tag $CODE_EDITOR_VERSION..."
128+
gh release create "$CODE_EDITOR_VERSION" ./*.tar.gz \
129+
--title "Release $CODE_EDITOR_VERSION" \
130+
--notes "Release $CODE_EDITOR_VERSION
131+
132+
SageMaker Code Editor Version: $SAGEMAKER_VERSION" \
109133
$PRERELEASE_FLAG
110134
fi
111135
handle-failures:

RELEASE.md

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,25 @@ We use major.minor branches (e.g., `1.0`, `1.1`, `2.1`) for releases.
1515

1616
### Release Process
1717

18-
1. **Determine version**: Choose tag name based on the commit's branch
19-
- Tag format: `major.minor.patch` matching the branch the commit belongs to
20-
- Example: Commit on `1.0` branch → tag `1.0.0`, `1.0.1`, etc.
21-
22-
2. **Create tag**: Choose one of these methods:
23-
- **Command line**: Push tag to trigger release workflow
24-
```bash
25-
git tag 1.0.0
26-
git push origin 1.0.0
27-
```
28-
- **GitHub Actions**: Manually run "Create release" workflow from Actions tab
29-
- **GitHub UI**: Go to Releases → Create a new release
30-
31-
3. **Release notes**: Include code-oss version information in the release description
18+
1. **Determine versions**:
19+
- **Code Editor version**: Choose tag name based on the commit's branch
20+
- Tag format: `major.minor.patch` matching the branch the commit belongs to
21+
- Example: Commit on `1.0` branch → tag `1.0.0`, `1.0.1`, etc.
22+
- **SageMaker Code Editor version**: Determine the corresponding SageMaker version
23+
- Example: Code Editor `1.0.1` → SageMaker Code Editor `1.8.0b7`
24+
25+
2. **Create release**:
26+
- Go to **Actions****Create release****Run workflow**
27+
- Select the branch you want to release from (e.g., `1.0`)
28+
- Enter:
29+
- **Code Editor version**: `1.0.1` (semantic version x.y.z or x.y.z-rc.N.)
30+
- **SageMaker Code Editor version**: `1.8.0b7` (any format)
31+
- Click **Run workflow**
32+
- The workflow will:
33+
- Create tag on the current commit
34+
- Fetch build artifacts for that commit
35+
- Inject both versions into product.json
36+
- Create GitHub release with both tarballs
37+
38+
3. **Release notes**: Include code-oss version and Sagemaker Code Editor Version information in the release description
3239

patches/sagemaker.series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ sagemaker/sagemaker-extension-smus-support.diff
3939
sagemaker/post-startup-notifications.diff
4040
sagemaker/sagemaker-extensions-sync.diff
4141
sagemaker/fix-port-forwarding.diff
42+
sagemaker/display-both-versions-in-about.diff
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Index: code-editor-src/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
2+
===================================================================
3+
--- code-editor-src.orig/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
4+
+++ code-editor-src/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
5+
@@ -79,8 +79,8 @@ export class BrowserDialogHandler extend
6+
async about(): Promise<void> {
7+
const detailString = (useAgo: boolean): string => {
8+
return localize('aboutDetail',
9+
- "Code Editor Version: {0}\nCode - OSS Version: {1}\nDate: {2}\nBrowser: {3}",
10+
- this.productService.codeEditorVersion || 'Unknown',
11+
+ "SageMaker Code Editor Version: {0}\nCode - OSS Version: {1}\nDate: {2}\nBrowser: {3}",
12+
+ this.productService.sagemakerCodeEditorVersion || 'Unknown',
13+
this.productService.version || 'Unknown',
14+
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown',
15+
navigator.userAgent
16+
Index: code-editor-src/src/vs/base/common/product.ts
17+
===================================================================
18+
--- code-editor-src.orig/src/vs/base/common/product.ts
19+
+++ code-editor-src/src/vs/base/common/product.ts
20+
@@ -62,6 +62,7 @@ export interface IProductConfiguration {
21+
readonly quality?: string;
22+
readonly commit?: string;
23+
readonly codeEditorVersion?: string;
24+
+ readonly sagemakerCodeEditorVersion?: string;
25+
26+
readonly nameShort: string;
27+
readonly nameLong: string;
28+
Index: code-editor-src/product.json
29+
===================================================================
30+
--- code-editor-src.orig/product.json
31+
+++ code-editor-src/product.json
32+
@@ -12,6 +12,7 @@
33+
"nameShort": "SageMaker Code Editor",
34+
"nameLong": "SageMaker Code Editor",
35+
"codeEditorVersion": "1.0.0",
36+
+ "sagemakerCodeEditorVersion":"1.0.0",
37+
"applicationName": "code",
38+
"dataFolderName": ".vscode-editor",
39+
"win32MutexName": "vscodeoss",

0 commit comments

Comments
 (0)