Reorganizing header #148
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 Publish | |
on: [push] | |
jobs: | |
Build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install Gatsby | |
run: npm install -g gatsby | |
- name: Run `npm install` | |
run: npm install | |
- name: Build the website | |
run: gatsby build | |
- name: Upload build artefacts | |
uses: actions/[email protected] | |
with: | |
name: built-website | |
path: public | |
retention-days: 1 | |
Publish: | |
runs-on: ubuntu-latest | |
needs: Build | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- name: Download build artefacts | |
uses: actions/[email protected] | |
with: | |
name: built-website | |
path: public/ | |
- name: Upload to S3 and invalidate Cloudfront distribution | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }} | |
AWS_EC2_METADATA_DISABLED: true | |
run: | | |
aws s3 sync public/ s3://caius.brindescu.com/ --delete | |
aws cloudfront create-invalidation --distribution-id E3PS86HUMZ47EU --paths '/*' |