-
Notifications
You must be signed in to change notification settings - Fork 67
215 lines (179 loc) · 9.76 KB
/
cd.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
name: AWS RUM Web Client Release
on:
workflow_dispatch:
jobs:
publish_to_cdn:
name: Publish New Release
runs-on: ubuntu-latest
environment: cdn-prod-release
permissions: write-all
steps:
- name: Checkout AWS RUM Web Client Repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Cache NPM modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Build Release
run: |
npm ci
npm run release
- name: Install PlayWright
run: npx playwright install --with-deps chromium
- name: Fetch AWS Credentials for Gamma Deployment
run: |
export AWS_ROLE_ARN=${{ secrets.ROLE_GAMMA }}
export AWS_WEB_IDENTITY_TOKEN_FILE=/tmp/awscreds
export AWS_DEFAULT_REGION=us-east-1
echo AWS_WEB_IDENTITY_TOKEN_FILE=$AWS_WEB_IDENTITY_TOKEN_FILE >> $GITHUB_ENV
echo AWS_ROLE_ARN=$AWS_ROLE_ARN >> $GITHUB_ENV
echo AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION >> $GITHUB_ENV
curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value' > $AWS_WEB_IDENTITY_TOKEN_FILE
- name: Publish to CloudWatch RUM Gamma CDN
id: publish-cdn-gamma
run: |
chmod u+x .github/scripts/deploy.sh
.github/scripts/deploy.sh ${{ secrets.BUCKET_GAMMA }}
- name: Validate Gamma versions.csv file
run: |
chmod u+x .github/scripts/validate_versions.sh
.github/scripts/validate_versions.sh ${{ secrets.BUCKET_GAMMA }}
- name: Fetch AWS Credentials for Gamma Smoke Test
run: |
export AWS_ROLE_ARN=${{ secrets.SMOKE_TEST_ROLE }}
export AWS_WEB_IDENTITY_TOKEN_FILE=/tmp/awscreds
export AWS_DEFAULT_REGION=us-east-1
echo AWS_WEB_IDENTITY_TOKEN_FILE=$AWS_WEB_IDENTITY_TOKEN_FILE >> $GITHUB_ENV
echo AWS_ROLE_ARN=$AWS_ROLE_ARN >> $GITHUB_ENV
echo AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION >> $GITHUB_ENV
curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value' > $AWS_WEB_IDENTITY_TOKEN_FILE
- name: Update Gamma Smoke Test Application
id: update-smoke-test-gamma-cdn
run: |
chmod u+x .github/scripts/update_smoke_test.sh
.github/scripts/update_smoke_test.sh ${{ secrets.SMOKE_MONITOR }} ${{ secrets.SMOKE_REGION }} ${{ secrets.SMOKE_ARN }} ${{ secrets.SMOKE_IDENTITY }} ${{ secrets.CONFIG_ENDPOINT }} ${{ secrets.CDN_GAMMA }}
- name: Build Smoke Test Application - NPM/ES
id: build-npm-es-application-pre-release
run: |
chmod u+x .github/scripts/build_npm_applications.sh
.github/scripts/build_npm_applications.sh "PRE" "NPM-ES"
- name: Build Smoke Test Application - NPM/CJS
id: build-npm-cjs-application-pre-release
run: |
chmod u+x .github/scripts/build_npm_applications.sh
.github/scripts/build_npm_applications.sh "PRE" "NPM-CJS"
- name: Upload Gamma Smoke Tests to CloudFront
id: upload-smoke-test-gamma
run: |
chmod u+x .github/scripts/upload_smoke_test.sh
.github/scripts/upload_smoke_test.sh ${{ secrets.SMOKE_BUCKET }}
- name: Run Smoke Test (NPM ES)
env:
URL: ${{ secrets.SMOKE_URL }}
MONITOR: ${{ secrets.SMOKE_MONITOR }}
ENDPOINT: ${{ secrets.SMOKE_ENDPOINT }}
NAME: ${{ secrets.SMOKE_MONITOR_NAME }}
INSTALL_METHOD: 'NPM-ES'
run: |
curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value' > $AWS_WEB_IDENTITY_TOKEN_FILE
npm run smoke:headless
timeout-minutes: 10
- name: Run Smoke Test (NPM CJS)
env:
URL: ${{ secrets.SMOKE_URL }}
MONITOR: ${{ secrets.SMOKE_MONITOR }}
ENDPOINT: ${{ secrets.SMOKE_ENDPOINT }}
NAME: ${{ secrets.SMOKE_MONITOR_NAME }}
INSTALL_METHOD: 'NPM-CJS'
run: |
curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value' > $AWS_WEB_IDENTITY_TOKEN_FILE
npm run smoke:headless
timeout-minutes: 10
- name: Run Gamma Smoke Test (CDN GAMMA)
env:
URL: ${{ secrets.SMOKE_URL }}
MONITOR: ${{ secrets.SMOKE_MONITOR }}
ENDPOINT: ${{ secrets.SMOKE_ENDPOINT }}
NAME: ${{ secrets.SMOKE_MONITOR_NAME }}
INSTALL_METHOD: 'CDN'
run: |
curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value' > $AWS_WEB_IDENTITY_TOKEN_FILE
npm run smoke:headless
- name: Fetch AWS Credentials for Prod Deployment
run: |
export AWS_ROLE_ARN=${{ secrets.ROLE }}
export AWS_WEB_IDENTITY_TOKEN_FILE=/tmp/awscreds
export AWS_DEFAULT_REGION=us-east-1
echo AWS_WEB_IDENTITY_TOKEN_FILE=$AWS_WEB_IDENTITY_TOKEN_FILE >> $GITHUB_ENV
echo AWS_ROLE_ARN=$AWS_ROLE_ARN >> $GITHUB_ENV
echo AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION >> $GITHUB_ENV
curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value' > $AWS_WEB_IDENTITY_TOKEN_FILE
- name: Publish to CloudWatch RUM Prod CDN
id: publish-cdn-prod
run: |
chmod u+x .github/scripts/deploy.sh
.github/scripts/deploy.sh ${{ secrets.BUCKET }}
- name: Validate Prod versions.csv file
run: |
chmod u+x .github/scripts/validate_versions.sh
.github/scripts/validate_versions.sh ${{ secrets.BUCKET }}
- name: Fetch AWS Credentials for Prod Smoke Test
run: |
export AWS_ROLE_ARN=${{ secrets.SMOKE_TEST_ROLE }}
export AWS_WEB_IDENTITY_TOKEN_FILE=/tmp/awscreds
export AWS_DEFAULT_REGION=us-east-1
echo AWS_WEB_IDENTITY_TOKEN_FILE=$AWS_WEB_IDENTITY_TOKEN_FILE >> $GITHUB_ENV
echo AWS_ROLE_ARN=$AWS_ROLE_ARN >> $GITHUB_ENV
echo AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION >> $GITHUB_ENV
curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value' > $AWS_WEB_IDENTITY_TOKEN_FILE
- name: Update Prod Smoke Test Application
id: update-smoke-test-prod-cdn
run: |
chmod u+x .github/scripts/update_smoke_test.sh
.github/scripts/update_smoke_test.sh ${{ secrets.SMOKE_MONITOR }} ${{ secrets.SMOKE_REGION }} ${{ secrets.SMOKE_ARN }} ${{ secrets.SMOKE_IDENTITY }} ${{ secrets.CONFIG_ENDPOINT }} ${{ secrets.CDN }}
- name: Upload Prod Smoke Tests to CloudFront
id: upload-smoke-test-prod
run: |
chmod u+x .github/scripts/upload_smoke_test.sh
.github/scripts/upload_smoke_test.sh ${{ secrets.SMOKE_BUCKET }}
- name: Run Prod Smoke Test (CDN)
env:
URL: ${{ secrets.SMOKE_URL }}
MONITOR: ${{ secrets.SMOKE_MONITOR }}
ENDPOINT: ${{ secrets.SMOKE_ENDPOINT }}
NAME: ${{ secrets.SMOKE_MONITOR_NAME }}
INSTALL_METHOD: 'CDN'
run: npm run smoke:headless
- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Build Smoke Test Application - NPM/ES (Post NPM Release)
id: build-npm-es-application-post-release
run: |
chmod u+x .github/scripts/build_npm_applications.sh
.github/scripts/build_npm_applications.sh "POST" "NPM-ES"
- name: Build Smoke Test Application - NPM/CJS (Post NPM Release)
id: build-npm-cjs-application-post-release
run: |
chmod u+x .github/scripts/build_npm_applications.sh
.github/scripts/build_npm_applications.sh "POST" "NPM-CJS"
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: 'v${{ steps.publish-cdn.outputs.current-version }}'
release_name: 'Release ${{ steps.publish-cdn.outputs.current-version }}'
body: 'See [CHANGELOG](https://github.com/aws-observability/aws-rum-web/blob/main/CHANGELOG.md) for details.'
draft: true
prerelease: false