Merge pull request #14 from vle-miu/master #1
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 & Deploy | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: ["20.x"] | |
steps: | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install packages | |
run: yarn install | |
- name: Build | |
run: | | |
unset CI | |
yarn build:prod | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build | |
path: build | |
deploy: | |
if: ${{ github.ref == 'refs/heads/master' }} | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: build | |
path: build | |
- name: Deploy to S3 | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_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: "build" |