-
Notifications
You must be signed in to change notification settings - Fork 11
46 lines (43 loc) · 1.61 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
40
41
42
43
44
45
46
name: Deploy to Production
on:
push:
branches: [prod]
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: production
url: https://ads.brave.com
steps:
- name: Install pnpm
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3
with:
version: 9
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Use Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version-file: ".node-version"
cache: pnpm
- name: Install dependencies
run: pnpm install
- run: pnpm check
- name: Build
env:
REACT_APP_SERVER_ADDRESS: ${{ secrets.REACT_PRODUCTION_APP_SERVER_ADDRESS }}
REACT_APP_GIT_SHA1: ${{ github.sha }}
run: |
export REACT_APP_BUILD_TIME=$(date -Iseconds)
pnpm build
- run: pnpm 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: |
cd build
aws s3 sync ./static/ "s3://ads-ui-production/static/" --cache-control "max-age=31536000, public"
aws s3 sync . "s3://ads-ui-production/" --exclude "static/*" --cache-control "max-age=60, public"
aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"