Use s3 sync instead of cp #7
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: Frontend Build and upload to S3 | |
on: | |
push: | |
branches: [ master ] | |
paths: | |
- 'frontend/**' | |
- '.github/workflows/frontend_build_push.yml' | |
pull_request: | |
branches: [ master ] | |
paths: | |
- 'frontend/**' | |
- '.github/workflows/frontend_build_push.yml' | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build_and_upload: | |
runs-on: ubuntu-latest | |
environment: Production | |
env: | |
CI: false | |
strategy: | |
matrix: | |
node-version: [ 16 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: cd frontend/ && npm install --legacy-peer-deps | |
- name: Build frontend | |
run: cd frontend/ && npm run build | |
- name: Authenticate to AWS | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: us-east-1 | |
role-to-assume: ${{ secrets.AWS_OIDC_ROLE }} | |
role-session-name: fAIrGithub | |
- name: Upload to S3 | |
run: cd frontend/build && aws s3 sync . s3://${{ vars.FRONTEND_BUCKET }}/ |