-
Notifications
You must be signed in to change notification settings - Fork 12
85 lines (73 loc) · 2.75 KB
/
ci-cd.yml
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
name: ci-cd
on:
pull_request:
branches:
- master
- development
push:
branches:
- '*'
permissions:
contents: read
id-token: write
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up nodejs
uses: actions/setup-node@v2
with:
node-version: 'lts/*'
cache: 'npm'
- name: npm CI
run: npm ci
- name: npm Check
run: npm run check
- name: npm Test
run: npm run build && npm run test # tests require build to use JS SDK in localhost mode
- name: npm Build
run: BUILD_BRANCH=$(echo "${GITHUB_REF#refs/heads/}") BUILD_COMMIT=${{ github.sha }} npm run build
- name: Configure AWS credentials (development)
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }}
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::079419646996:role/public-assets
aws-region: us-east-1
- name: Upload to S3 (development)
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }}
run: aws s3 sync $SOURCE_DIR s3://$BUCKET/$DEST_DIR $ARGS
env:
BUCKET: split-public-stage
SOURCE_DIR: ./umd
DEST_DIR: sdk
ARGS: --acl public-read --follow-symlinks --cache-control max-age=31536000,public
# TODO: Remove this upload step to the old (dev) Bucket
- name: Upload to S3 (development) (legacy)
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }}
uses: jakejarvis/[email protected]
with:
args: --acl public-read --follow-symlinks --cache-control max-age=31536000,public
env:
AWS_S3_BUCKET: 'aws-development-split-public'
AWS_ACCESS_KEY_ID: ${{ secrets.PUBLIC_ASSETS_STAGE_USER }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PUBLIC_ASSETS_STAGE_KEY }}
AWS_REGION: 'us-east-1'
SOURCE_DIR: './umd'
DEST_DIR: sdk
- name: Configure AWS credentials (master)
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::825951051969:role/public-assets
aws-region: us-east-1
- name: Upload to S3 (master)
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: aws s3 sync $SOURCE_DIR s3://$BUCKET/$DEST_DIR $ARGS
env:
BUCKET: split-public
SOURCE_DIR: ./umd
DEST_DIR: sdk
ARGS: --acl public-read --follow-symlinks --cache-control max-age=31536000,public