Skip to content

Commit 94f4f4a

Browse files
Merge branch 'sachinh-inject-code-editor-version' into 1.0
2 parents 606d795 + d0dfb3e commit 94f4f4a

File tree

3 files changed

+67
-16
lines changed

3 files changed

+67
-16
lines changed

.github/workflows/build-targets.yaml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ jobs:
1010
build:
1111
name: Build Code Editor Targets
1212
runs-on: ubuntu-latest
13-
environment: build-targets-workflow-env
1413
strategy:
1514
matrix:
1615
build-target: [code-editor-server, code-editor-sagemaker-server, code-editor-web-embedded, code-editor-web-embedded-with-terminal]
@@ -73,4 +72,31 @@ jobs:
7372
with:
7473
name: ${{ github.sha }}-${{ matrix.build-target }}-build
7574
path: ${{ matrix.build-target }}-build.tar.gz
76-
retention-days: 90
75+
retention-days: 90
76+
handle-failures:
77+
name: Handle Failures
78+
runs-on: ubuntu-latest
79+
needs: build
80+
environment: build-targets-workflow-env
81+
if: failure()
82+
permissions:
83+
id-token: write # Required for OIDC
84+
env:
85+
REPOSITORY: ${{ github.repository }}
86+
AWS_ROLE_TO_ASSUME: ${{ secrets.AWS_ROLE_TO_ASSUME }}
87+
steps:
88+
- name: Use role credentials for metrics
89+
id: aws-creds
90+
continue-on-error: ${{ env.REPOSITORY != 'aws/code-editor' }}
91+
uses: aws-actions/configure-aws-credentials@v4
92+
with:
93+
role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }}
94+
aws-region: us-east-1
95+
- name: Report failure
96+
if: steps.aws-creds.outcome == 'success'
97+
run: |
98+
aws cloudwatch put-metric-data \
99+
--namespace "GitHub/Workflows" \
100+
--metric-name "ExecutionsFailed" \
101+
--dimensions "Repository=${{ env.REPOSITORY }},Workflow=BuildTargets" \
102+
--value 1

.github/workflows/release.yaml

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ jobs:
1515
runs-on: ubuntu-latest
1616
permissions:
1717
contents: write # Required for creating releases
18-
environment: release-workflow-env
1918
env:
20-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2119
COMMIT_SHA: ${{ github.sha }}
22-
REPOSITORY: ${{ github.repository }}
2320
VERSION_NUM: ${{ github.event.inputs.version || github.ref_name }}
2421
SAGEMAKER_ARTIFACT_PREFIX: "code-editor-sagemaker-server"
2522
steps:
@@ -28,23 +25,20 @@ jobs:
2825
with:
2926
fetch-depth: 0
3027

31-
- name: Validate tag format
28+
- name: Validate tag
3229
run: |
3330
if ! echo "$VERSION_NUM" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
3431
echo "Tag $VERSION_NUM does not follow semantic version pattern (x.y.z). Skipping release."
3532
exit 78 # neutral exit code
3633
fi
3734
echo "Tag $VERSION_NUM follows valid semantic version pattern"
3835
39-
- name: Check if tag is from release branch
40-
run: |
41-
# Get the branch that contains this tag
42-
BRANCHES=$(git branch -r --contains $COMMIT_SHA | grep -E 'origin/[0-9]+\.[0-9]+' || true)
43-
if [ -z "$BRANCHES" ]; then
44-
echo "Tag $VERSION_NUM is not from a *.* release branch. Skipping release."
45-
exit 78 # neutral exit code
46-
fi
47-
echo "Tag is from a valid release branch: $BRANCHES"
36+
# Verify release tag is made on the correct major.minor version branch.
37+
# The command will fail with exit code 1 if the tag is not on a valid release branch.
38+
MAJOR_MINOR=$(echo "$VERSION_NUM" | cut -d'.' -f1,2)
39+
git branch --remote --contains $COMMIT_SHA origin/$MAJOR_MINOR
40+
41+
echo "Tag is from a valid branch."
4842
4943
- name: Download sagemaker artifacts by commit ID
5044
run: |
@@ -108,4 +102,31 @@ jobs:
108102
gh release create "$VERSION_NUM" *.tar.gz \
109103
--title "Release $VERSION_NUM" \
110104
--notes "Release $VERSION_NUM"
111-
fi
105+
fi
106+
handle-failures:
107+
name: Handle Failures
108+
runs-on: ubuntu-latest
109+
needs: release
110+
environment: release-workflow-env
111+
if: failure()
112+
permissions:
113+
id-token: write # Required for OIDC
114+
env:
115+
REPOSITORY: ${{ github.repository }}
116+
AWS_ROLE_TO_ASSUME: ${{ secrets.AWS_ROLE_TO_ASSUME }}
117+
steps:
118+
- name: Use role credentials for metrics
119+
id: aws-creds
120+
continue-on-error: ${{ env.REPOSITORY != 'aws/code-editor' }}
121+
uses: aws-actions/configure-aws-credentials@v4
122+
with:
123+
role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }}
124+
aws-region: us-east-1
125+
- name: Report failure
126+
if: steps.aws-creds.outcome == 'success'
127+
run: |
128+
aws cloudwatch put-metric-data \
129+
--namespace "GitHub/Workflows" \
130+
--metric-name "ExecutionsFailed" \
131+
--dimensions "Repository=${{ env.REPOSITORY }},Workflow=Release" \
132+
--value 1

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ The repository structure is the following:
1010
- `patches`: Patch files created by [Quilt](https://linux.die.net/man/1/quilt), grouped around features.
1111
- `third-party-src`: Git submodule linking to the upstream [Code-OSS](https://github.com/microsoft/vscode/) commit. The patches are applied on top of this specific commit.
1212

13+
## Creating a new release
14+
15+
See [RELEASE](RELEASE.md) for more information.
16+
1317
## Troubleshooting and Feedback
1418

1519
See [CONTRIBUTING](CONTRIBUTING.md#reporting-bugsfeature-requests) for more information.

0 commit comments

Comments
 (0)