build(deps): bump cross-spawn from 7.0.3 to 7.0.6 in /frontend (#282) #218
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 frontend | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build-frontend: | |
runs-on: ubuntu-latest | |
if: github.repository == 'pschlan/cron-job.org' | |
environment: | |
name: beta | |
url: https://console.beta.cron-job.org | |
strategy: | |
matrix: | |
node-version: [16.x] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
cache-dependency-path: ./frontend/package-lock.json | |
- run: 'echo "$FRONTEND_CONFIG" > ./src/utils/Config.js' | |
shell: bash | |
env: | |
FRONTEND_CONFIG: ${{secrets.FRONTEND_CONFIG}} | |
working-directory: ./frontend | |
- run: npm ci | |
working-directory: ./frontend | |
- run: npm run build | |
working-directory: ./frontend | |
- name: Deploy to S3/CloudFront | |
run: | | |
aws s3 sync ./build s3://$FRONTEND_S3_BUCKET --exclude "*.map" --exclude "index.html" | |
aws s3 cp ./build/index.html s3://$FRONTEND_S3_BUCKET/index.html --metadata-directive REPLACE --cache-control max-age=0,s-maxage=86400 --content-type text/html | |
aws cloudfront create-invalidation --distribution-id $FRONTEND_CF_DISTRIBUTION_ID --paths "/*" | |
working-directory: ./frontend | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: eu-west-1 | |
FRONTEND_S3_BUCKET: ${{ secrets.FRONTEND_S3_BUCKET }} | |
FRONTEND_CF_DISTRIBUTION_ID: ${{ secrets.FRONTEND_CF_DISTRIBUTION_ID }} |