Skip to content

Deploy

Deploy #382

Workflow file for this run

name: Deploy
on:
push:
branches:
- master
workflow_dispatch:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Install Hugo
run: |
wget https://github.com/gohugoio/hugo/releases/download/v0.136.1/hugo_extended_0.136.1_linux-amd64.deb --output-document hugo.deb
sudo dpkg -i hugo.deb
- name: Install AWS CLI
run: |
pip3 install --upgrade setuptools
pip3 install awscli --upgrade --user
- name: Install npm and purgecss
run: |
sudo apt install nodejs
npm install postcss postcss-cli @fullhuman/postcss-purgecss --save
- name: Initialize and pull submodule
run: |
git submodule update --init --recursive
- name: Build Site
run: |
hugo version
hugo --minify --gc
- name: Push to S3 and CloudFront
run: |
aws s3 sync public/ s3://${{ secrets.S3_BUCKET_NAME }} --delete
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths '/*'