Skip to content

Commit

Permalink
cd: Add workflow for deploying react frontend to S3
Browse files Browse the repository at this point in the history
  • Loading branch information
Arabasta committed Jul 13, 2024
1 parent 3c62777 commit c3cc9e4
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/cd_react_frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CD deploy to S3

on:
push:
branches:
- 'release/v[0-9]+.[0-9]+'

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.11.1'

- name: Install dependencies
working-directory: ./react_frontend
run: npm install

- name: Set environment variables
run: echo "REACT_APP_API_URL=${{ secrets.REACT_APP_API_URL }}" >> $GITHUB_ENV

- name: Build React app
working-directory: ./react_frontend
run: npm run build

- name: Deploy to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'ap-southeast-1'
SOURCE_DIR: './react_frontend/build'

0 comments on commit c3cc9e4

Please sign in to comment.