Skip to content

Commit

Permalink
build: add deploy to prod workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pyphilia committed Jul 2, 2021
1 parent fa95a22 commit 5dff033
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/deployProd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: deploy prod build to aws

on:
push:
branches:
- main
jobs:
deploy-dev:
runs-on: ubuntu-latest
env:
# default build directory
BUILD_FOLDER: 'build/'
VERSION: 'latest'

REACT_APP_API_HOST: ${{ secrets.API_HOST }}
REACT_APP_UPLOAD_METHOD: default
REACT_APP_S3_FILES_HOST: ${{ secrets.S3_FILES_HOST }}
REACT_APP_SHOW_NOTIFICATIONS: true
REACT_APP_AUTHENTICATION_HOST: ${{ secrets.AUTH_HOST }}
REACT_APP_GRAASP_PERFORM_HOST: ${{ secrets.PERFORM_HOST }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Yarn Set Up
uses: actions/setup-node@v2

- run: yarn install --network-concurrency 1
- run: yarn build

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.COMPOSE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.COMPOSE_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.COMPOSE_AWS_REGION }}

- name: Copy files to AWS Bucket
env:
COMPOSE_DIR: '${{ secrets.COMPOSE_PROD_BUCKET }}'
run: aws s3 sync ${{env.BUILD_FOLDER}} s3://${COMPOSE_DIR} --delete

- name: Invalidate cloudfront distribution
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.COMPOSE_PROD_CLOUDFRONT_DISTRIBUTION }} --paths '/*'
3 changes: 3 additions & 0 deletions src/serviceWorker.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* eslint-disable no-console */
/* eslint-disable no-param-reassign */
/* eslint-disable no-use-before-define */
// This optional code is used to register a service worker.
// register() is not called by default.

Expand Down

0 comments on commit 5dff033

Please sign in to comment.