-
Notifications
You must be signed in to change notification settings - Fork 11
39 lines (36 loc) · 1.28 KB
/
deploy-to-production.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
name: Deploy to Production
on:
push:
branches: [prod]
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: production
url: https://ads.brave.com
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Use Node.js
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: 18.12.0
cache: npm
- name: Install dependencies
run: npm ci
- name: Build
env:
REACT_APP_SERVER_ADDRESS: ${{ secrets.REACT_PRODUCTION_APP_SERVER_ADDRESS }}
# setting CI to false is temporary, while we still have lint errors
CI: false
run: npm run build
- run: npm run check:audit
- run: npm test
- name: Deploy static files
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PRODUCTION_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PRODUCTION_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_PRODUCTION_DISTRIBUTION_ID }}
run: |
aws s3 sync build/ s3://ads-ui-production/ --delete
aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"