Skip to content

Commit 41a9101

Browse files
author
Reno Seo
authored
cd: Create direct CDN deployment and NPM deprecation workflow (#391)
1 parent f81bcf2 commit 41a9101

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Rollback CDN Live Version
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish_to_cdn:
8+
name: Publish Release
9+
runs-on: ubuntu-latest
10+
environment: cdn-prod-release
11+
permissions: write-all
12+
steps:
13+
- name: Checkout AWS RUM Web Client Repository
14+
uses: actions/checkout@v3
15+
16+
- name: Setup Node
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '16.x'
20+
registry-url: 'https://registry.npmjs.org'
21+
22+
- name: Fetch AWS Credentials for Deployment
23+
run: |
24+
export AWS_ROLE_ARN=${{ secrets.ROLE }}
25+
export AWS_WEB_IDENTITY_TOKEN_FILE=/tmp/awscreds
26+
export AWS_DEFAULT_REGION=us-east-1
27+
28+
echo AWS_WEB_IDENTITY_TOKEN_FILE=$AWS_WEB_IDENTITY_TOKEN_FILE >> $GITHUB_ENV
29+
echo AWS_ROLE_ARN=$AWS_ROLE_ARN >> $GITHUB_ENV
30+
echo AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION >> $GITHUB_ENV
31+
32+
curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value' > $AWS_WEB_IDENTITY_TOKEN_FILE
33+
34+
- name: Cache NPM modules
35+
uses: actions/cache@v3
36+
with:
37+
path: ~/.npm
38+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
39+
restore-keys: |
40+
${{ runner.os }}-node-
41+
42+
- name: Build Release
43+
run: |
44+
npm ci
45+
npm run release
46+
47+
- name: Publish to CloudWatch RUM CDN
48+
id: publish-cdn
49+
run: |
50+
chmod u+x .github/scripts/deploy.sh
51+
.github/scripts/deploy.sh ${{ secrets.BUCKET }}
52+
53+
- name: Fetch AWS Credentials for Smoke Test
54+
run: |
55+
export AWS_ROLE_ARN=${{ secrets.SMOKE_TEST_ROLE }}
56+
export AWS_WEB_IDENTITY_TOKEN_FILE=/tmp/awscreds
57+
export AWS_DEFAULT_REGION=us-east-1
58+
59+
echo AWS_WEB_IDENTITY_TOKEN_FILE=$AWS_WEB_IDENTITY_TOKEN_FILE >> $GITHUB_ENV
60+
echo AWS_ROLE_ARN=$AWS_ROLE_ARN >> $GITHUB_ENV
61+
echo AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION >> $GITHUB_ENV
62+
63+
curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value' > $AWS_WEB_IDENTITY_TOKEN_FILE
64+
65+
- name: Update Smoke Test Application
66+
id: update-smoke-test
67+
run: |
68+
chmod u+x .github/scripts/update_smoke_test.sh
69+
.github/scripts/update_smoke_test.sh ${{ secrets.SMOKE_MONITOR }} ${{ secrets.SMOKE_REGION }} ${{ secrets.SMOKE_ARN }} ${{ secrets.SMOKE_IDENTITY }} ${{ secrets.CONFIG_ENDPOINT }} ${{ secrets.CDN }} >> processed_smoke.html
70+
71+
- name: Upload Smoke Test to CloudFront
72+
id: upload-smoke-test
73+
run: |
74+
chmod u+x .github/scripts/upload_smoke_test.sh
75+
.github/scripts/upload_smoke_test.sh ${{ secrets.SMOKE_BUCKET }}
76+
77+
- name: Install PlayWright
78+
run: npx playwright install --with-deps chromium
79+
80+
- name: Run Smoke Test
81+
env:
82+
URL: ${{ secrets.SMOKE_URL }}
83+
MONITOR: ${{ secrets.SMOKE_MONITOR }}
84+
ENDPOINT: ${{ secrets.SMOKE_ENDPOINT }}
85+
NAME: ${{ secrets.SMOKE_MONITOR_NAME }}
86+
run: npm run smoke:headless
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Deprecate NPM Version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Deprecating version'
8+
required: true
9+
message:
10+
description: 'Deprecation reason'
11+
required: true
12+
type: string
13+
14+
jobs:
15+
deprecate_version:
16+
name: Deprecate version
17+
runs-on: ubuntu-latest
18+
environment: cdn-prod-release
19+
permissions: write-all
20+
steps:
21+
- name: Setup Node
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: '16.x'
25+
registry-url: 'https://registry.npmjs.org'
26+
- name: Deprecate Version
27+
run: npm deprecate aws-rum-web@${{ github.event.inputs.version }} ${{ github.event.inputs.message }}
28+
env:
29+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)