Data aggregation (#57) #99
Workflow file for this run
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 and deploy demo web app | |
on: | |
push: | |
branches: | |
- develop | |
paths: | |
- "src/**" | |
pull_request: | |
branches: | |
- master | |
- develop | |
paths: | |
- "src/**" | |
workflow_dispatch: | |
inputs: | |
buildManually: | |
description: 'Run build manually' | |
required: true | |
default: 'build' | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
environment: dev | |
env: | |
ALBUM_APP_TITLE: ${{ vars.ALBUM_APP_TITLE }} | |
STATIC_FILES_URL: ${{ vars.STATIC_FILES_URL }} | |
IMAGEKIT_CDN_URL: ${{ vars.IMAGEKIT_CDN_URL }} | |
MAPBOX_API_KEY: ${{ secrets.MAPBOX_API_KEY }} | |
AWS_API_GATEWAY_URL: ${{ vars.AWS_API_GATEWAY_URL }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_FOR_GITHUB_DEPLOY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_GITHUB_DEPLOY }} | |
MAP_CENTRE_LNG: ${{ vars.MAP_CENTRE_LNG }} | |
MAP_CENTRE_LAT: ${{ vars.MAP_CENTRE_LAT }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm install | |
- name: Write .env file | |
run: | | |
tee .env <<EOF | |
ALBUM_APP_TITLE=$ALBUM_APP_TITLE | |
STATIC_FILES_URL=$STATIC_FILES_URL | |
IMAGEKIT_CDN_URL=$IMAGEKIT_CDN_URL | |
MAPBOX_API_KEY=$MAPBOX_API_KEY | |
AWS_API_GATEWAY_URL=$AWS_API_GATEWAY_URL | |
GOOGLE_CLIENT_ID=DEMO_GOOGLE_CLIENT_ID | |
MAP_CENTRE_LNG=$MAP_CENTRE_LNG | |
MAP_CENTRE_LAT=$MAP_CENTRE_LAT | |
EOF | |
- name: Test and build | |
run: | | |
npm run test | |
npm run build | |
- name: Clean up old files | |
uses: keithweaver/aws-s3-github-action@master | |
with: | |
command: rm | |
source: s3://${{ vars.AWS_S3_BUCKET_NAME }}/assets/ | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_FOR_GITHUB_DEPLOY }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_GITHUB_DEPLOY }} | |
aws_region: us-east-1 | |
flags: --recursive | |
- name: Upload to S3 | |
uses: keithweaver/aws-s3-github-action@master | |
with: | |
source: dist/spa | |
destination: s3://${{ vars.AWS_S3_BUCKET_NAME }} | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_FOR_GITHUB_DEPLOY }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_GITHUB_DEPLOY }} | |
aws_region: us-east-1 | |
flags: --recursive | |
- name: Invalidate CloudFront | |
uses: chetan/invalidate-cloudfront-action@master | |
env: | |
DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} | |
PATHS: / | |
AWS_REGION: us-east-1 | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_FOR_GITHUB_DEPLOY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_GITHUB_DEPLOY }} |