88 branches :
99 - ' *'
1010
11+ concurrency :
12+ group : ${{ github.workflow }}-${{ github.event_name == 'push' && github.run_number || github.event.pull_request.number }}
13+ cancel-in-progress : true
14+
1115permissions :
1216 contents : read
1317 id-token : write
@@ -28,46 +32,108 @@ jobs:
2832 node-version : ' 16.16.0'
2933 cache : ' npm'
3034
31- - name : npm CI
35+ - name : npm ci
3236 run : npm ci
3337
34- - name : npm Check
38+ - name : npm check
3539 run : npm run check
3640
37- - name : npm Test
38- run : npm run build && npm run test -- --coverage # tests require build to use JS SDK in localhost mode
41+ - name : npm test
42+ run : npm run test -- --coverage
3943
40- - name : npm Build
44+ - name : npm build
4145 run : BUILD_BRANCH=$(echo "${GITHUB_REF#refs/heads/}") BUILD_COMMIT=${{ github.sha }} npm run build
4246
43- - name : Configure AWS credentials (development)
44- if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }}
45- uses : aws-actions/configure-aws-credentials@v1
47+ - name : Store assets
48+ if : ${{ github.event_name == 'push' && (github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master') }}
49+ uses : actions/upload-artifact@v3
50+ with :
51+ name : assets
52+ path : umd/
53+ retention-days : 1
54+
55+ upload-stage :
56+ name : Upload assets
57+ runs-on : ubuntu-latest
58+ needs : build
59+ if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }}
60+ strategy :
61+ matrix :
62+ environment :
63+ - stage
64+ - stage-eu
65+ include :
66+ - environment : stage
67+ account_id : " 079419646996"
68+ bucket : split-public-stage
69+ - environment : stage-eu
70+ account_id : " 901851837056"
71+ bucket : split-public-stage-eu-west-1
72+
73+ steps :
74+ - name : Download assets
75+ uses : actions/download-artifact@v3
4676 with :
47- role-to-assume : arn:aws:iam::079419646996:role/public-assets
77+ name : assets
78+ path : umd
79+
80+ - name : Display structure of assets
81+ run : ls -R
82+ working-directory : umd
83+
84+ - name : Configure AWS credentials
85+ uses : aws-actions/configure-aws-credentials@v1-node16
86+ with :
87+ role-to-assume : arn:aws:iam::${{ matrix.account_id }}:role/gha-public-assets-role
4888 aws-region : us-east-1
4989
50- - name : Upload to S3 (development)
51- if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }}
90+ - name : Upload to S3
5291 run : aws s3 sync $SOURCE_DIR s3://$BUCKET/$DEST_DIR $ARGS
5392 env :
54- BUCKET : split-public-stage
93+ BUCKET : ${{ matrix.bucket }}
5594 SOURCE_DIR : ./umd
5695 DEST_DIR : sdk
5796 ARGS : --acl public-read --follow-symlinks --cache-control max-age=31536000,public
5897
59- - name : Configure AWS credentials (master)
60- if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
61- uses : aws-actions/configure-aws-credentials@v1
98+ upload-prod :
99+ name : Upload assets
100+ runs-on : ubuntu-latest
101+ needs : build
102+ if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
103+ strategy :
104+ matrix :
105+ environment :
106+ - prod
107+ - prod-eu
108+ include :
109+ - environment : prod
110+ account_id : " 825951051969"
111+ bucket : split-public
112+ - environment : prod-eu
113+ account_id : " 842946900133"
114+ bucket : split-public-eu-west-1
115+
116+ steps :
117+ - name : Download assets
118+ uses : actions/download-artifact@v3
119+ with :
120+ name : assets
121+ path : umd
122+
123+ - name : Display structure of assets
124+ run : ls -R
125+ working-directory : umd
126+
127+ - name : Configure AWS credentials
128+ uses : aws-actions/configure-aws-credentials@v1-node16
62129 with :
63- role-to-assume : arn:aws:iam::825951051969 :role/public-assets
130+ role-to-assume : arn:aws:iam::${{ matrix.account_id }} :role/gha- public-assets-role
64131 aws-region : us-east-1
65132
66- - name : Upload to S3 (master)
67- if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
133+ - name : Upload to S3
68134 run : aws s3 sync $SOURCE_DIR s3://$BUCKET/$DEST_DIR $ARGS
69135 env :
70- BUCKET : split-public
136+ BUCKET : ${{ matrix.bucket }}
71137 SOURCE_DIR : ./umd
72138 DEST_DIR : sdk
73139 ARGS : --acl public-read --follow-symlinks --cache-control max-age=31536000,public
0 commit comments