update link #28
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: Build and Push to S3 | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
permissions: | |
contents: read | |
jobs: | |
build_frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 20.x | |
- name: Git checkout | |
uses: actions/checkout@v2 | |
- name: Install packages | |
run: npm install | |
working-directory: frontend | |
- name: Production build | |
run: npm run build | |
working-directory: frontend | |
- name: Upload build | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build | |
path: frontend/build | |
deploy_to_s3: | |
runs-on: ubuntu-latest | |
needs: build_frontend | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v2 | |
- name: Download build | |
uses: actions/download-artifact@v2 | |
with: | |
name: build | |
path: frontend/build | |
- name: Deploy to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_PRODUCTION_BUCKET_NAME }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
SOURCE_DIR: "frontend/build" |