Update index.tsx #48
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 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
- name: setup node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: cache | |
uses: actions/cache@v2 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: install pacakges | |
run: yarn | |
- name: build | |
run: yarn build | |
- name: upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: static | |
path: build/ | |
deploy-main: | |
environment: main | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
steps: | |
- name: download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: static | |
path: build | |
- name: upload | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks | |
env: | |
AWS_REGION: ${{ secrets.S3_BUCKET_REGION }} | |
AWS_S3_BUCKET: ${{ secrets.S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
SOURCE_DIR: 'build' | |
- name: invalidate | |
uses: chetan/invalidate-cloudfront-action@master | |
env: | |
DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} | |
PATHS: '/ /index.html' | |
AWS_REGION: ${{ secrets.S3_BUCKET_REGION }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |