Deploy #371
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: 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@v3 | |
- name: Install Hugo | |
run: | | |
wget https://github.com/gohugoio/hugo/releases/download/v0.135.0/hugo_extended_0.135.0_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: 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 '/*' |