Merge pull request #10 from CatsMeow492/deployment/frontend #11
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 Frontend to S3 | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'frontend/**' # Only run when there are changes in the frontend directory | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Set environment variables | |
run: | | |
echo "REACT_APP_API_URL=${{ secrets.REACT_APP_API_URL }}" >> $GITHUB_ENV | |
echo "REACT_APP_GOOGLE_CLIENT_ID=${{ secrets.REACT_APP_GOOGLE_CLIENT_ID }}" >> $GITHUB_ENV | |
echo "REACT_APP_GOOGLE_CLIENT_SECRET=${{ secrets.REACT_APP_GOOGLE_CLIENT_SECRET }}" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: | | |
cd frontend | |
npm install | |
- name: Build project | |
run: | | |
cd frontend | |
npm run build | |
- name: Deploy to S3 | |
uses: jakejarvis/s3-sync-action@v0.5.1 | |
with: | |
args: --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 }} | |
SOURCE_DIR: 'frontend/build' |