Skip to content

Publish To Test

Publish To Test #176

name: Publish To Test
on:
workflow_dispatch:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.TEST_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: eu-central-1
AWS_DISTRIBUTION_ID: ${{ secrets.TEST_AWS_DISTRIBUTION_ID }}
AWS_BUCKET_NAME: ${{ secrets.TEST_AWS_BUCKET_NAME }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup node.js
uses: actions/setup-node@v1
with:
node-version: 18
- name: Build website
run: npm install gatsby-cli && npm run build
- name: Sync files to S3
run: aws s3 sync ./public/ s3://$AWS_BUCKET_NAME --acl public-read --delete --cache-control max-age=604800
- name: Notify CloudFront about the changes
run: aws cloudfront create-invalidation --distribution-id ${AWS_DISTRIBUTION_ID} --paths "/*"