-
Notifications
You must be signed in to change notification settings - Fork 5
40 lines (34 loc) · 1.2 KB
/
aws.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
name: Deploy to ECS
on:
push:
branches:
- main
workflow_dispatch:
env:
frontend-domain: emojify.net
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
jobs:
build-and-upload-frontend:
name: build and upload frontend
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@v2
with:
ref: main
- name: Create env file
run: |
touch .env
echo REACT_APP_GOOGLE_ANALYTICS_TRACKING_ID=${{ env.GA_TRACKING_ID }} >> .env
- name: Push build to S3 (destructive!)
env:
STACK_NAME: ${{ env.stack-name }}
CLOUDFRONT_DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION }}
run: |
yarn install
yarn build
aws s3 sync ./build s3://${{ env.frontend-domain }} --delete
aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION --paths "/robots.txt" "/favicon.ico" "/index.html" "/logo192.png" "/logo512.png" "/css/normalize.css" "/css/skeleton.css" "/css/util.css" "/asset-manifest.json"