Skip to content

Build frontend React App #49

Build frontend React App

Build frontend React App #49

name: Build frontend React App
on:
workflow_dispatch:
pull_request:
branches: [ main ]
types: closed
paths:
- 'frontend/**'
env:
working-directory: ./frontend
AWS_REGION: eu-central-1
AWS_S3_BUCKET: rimatch-app
build-folder: ./dist
VITE_BACKEND_URL: ${{ vars.BACKEND_URL}}
jobs:
Build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
working-directory: ${{ env.working-directory }}
- name: Build the project
run: npm run build
working-directory: ${{ env.working-directory }}
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{secrets.IAM_ROLE_GITHUB}}
aws-region: ${{env.AWS_REGION}}
- name: Copy build files to S3 bucket
run: |
aws s3 sync --delete ${{ env.build-folder }} s3://${{ env.AWS_S3_BUCKET }}
working-directory: ${{env.working-directory}}