more cleanup #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-18.04 | |
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" |