Skip to content

Commit 5650229

Browse files
authored
Add update version types to deployment workflow. (#63)
* Add update version types to deployment workflow. * Move deployment to script file. * Read release version from package.json
1 parent 8f5fbad commit 5650229

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

.github/scripts/deploy.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
version=$(npm pkg get version | sed 's/"//g')
4+
bucket=$1
5+
6+
aws s3api put-object --bucket $bucket --key "content/$version/cwr.js" --body build/assets/cwr.js
7+
aws s3api put-object --bucket $bucket --key "content/$version/LICENSE-THIRD-PARTY" --body LICENSE-THIRD-PARTY
8+
9+
if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
10+
then
11+
minorUpdate=$(echo $version | sed -En "s/^([0-9]+\.)[0-9]+\.[0-9]+/\1x/p")
12+
aws s3api put-object --bucket $bucket --key "content/$minorUpdate/cwr.js" --body build/assets/cwr.js
13+
aws s3api put-object --bucket $bucket --key "content/$minorUpdate/LICENSE-THIRD-PARTY" --body LICENSE-THIRD-PARTY
14+
patchUpdate=$(echo $version | sed -En "s/^([0-9]+\.[0-9]+\.)[0-9]+/\1x/p")
15+
aws s3api put-object --bucket $bucket --key "content/$patchUpdate/cwr.js" --body build/assets/cwr.js
16+
aws s3api put-object --bucket $bucket --key "content/$patchUpdate/LICENSE-THIRD-PARTY" --body LICENSE-THIRD-PARTY
17+
fi

.github/workflows/cd.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ name: AWS RUM Web Client Release
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
version:
7-
description: The version to tag the release with, e.g., 1.2.0, 1.2.1-alpha.1
8-
required: true
95

106
jobs:
117
publish_to_cdn:
@@ -50,8 +46,8 @@ jobs:
5046
5147
- name: Publish to CloudWatch RUM CDN
5248
run: |
53-
aws s3api put-object --bucket ${{ secrets.BUCKET }} --key 'content/${{ github.event.inputs.version }}/cwr.js' --body build/assets/cwr.js
54-
aws s3api put-object --bucket ${{ secrets.BUCKET }} --key 'content/${{ github.event.inputs.version }}/LICENSE-THIRD-PARTY' --body LICENSE-THIRD-PARTY
49+
chmod u+x .github/scripts/deploy.sh
50+
.github/scripts/deploy.sh ${{ secrets.BUCKET }}
5551
5652
- name: Publish to NPM
5753
run: npm publish

0 commit comments

Comments
 (0)