Deploy to Github Pages #497
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 to Github Pages | |
on: | |
push: | |
branches: [main] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Daily publish at 07:00Z to allow for scheduled posts | |
schedule: | |
- cron: '0 7 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Hugo resources | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-hugo-resources | |
with: | |
path: resources | |
key: ${{ env.cache-name }} | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: "^1.17.0" | |
- run: go version | |
- name: Cache Go Modules | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: "latest" | |
extended: true | |
- name: Build | |
run: hugo --minify --gc | |
- name: Deploy 🚀 | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: public | |
clean: true | |
single-commit: true |