Skip to content

aligned wca_logo (#123) #22

aligned wca_logo (#123)

aligned wca_logo (#123) #22

Workflow file for this run

name: Deploy frontend
on:
push:
branches:
- main
paths:
- "client/**"
- ".github/workflows/frontdeploy.yaml"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: "**/client/node_modules"
key: ${{ runner.os }}-v2-${{ hashFiles('**/client/package-lock.json') }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "21.x"
- name: Install dependencies
working-directory: ./client
run: npm install
- name: Replace version
working-directory: ./client
run: |
export GIT_HASH=$(git rev-parse --short HEAD)
export VITE_APP_DATE_VERSION=$(date -u +'%Y-%m-%d')
sed -i "s|VITE_APP_DATE_VERSION=local|VITE_APP_DATE_VERSION=${GIT_HASH}|g" .env
sed -i "s|VITE_APP_VERSION=local|VITE_APP_VERSION=${GIT_HASH}|g" .env
- name: Production build
working-directory: ./client
run: npm run build
- name: Synchronize files
working-directory: ./client
run: |
export AWS_ACCESS_KEY_ID=${{ secrets.CI_CD_AWS_ACCESS_KEY_ID }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.CI_CD_AWS_SECRET_ACCESS_KEY }}
export AWS_DEFAULT_REGION=${{ secrets.AWS_DEFAULT_REGION }}
aws configure set preview.cloudfront true
aws s3 sync dist s3://${{ secrets.AWS_S3_BUCKET }} --delete
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths /\*