Merge pull request #475 from sgfost/deps/upgrade-hugo-docsy #503
This file contains hidden or 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 deploy to GitHub Pages | |
on: | |
push: | |
branches: | |
- develop | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Read .env hugo version | |
id: hugo-version | |
run: | | |
. ./.env | |
echo "::set-output name=HUGO_VERSION::${HUGO_VERSION}" | |
echo "::set-output name=DOCSY_VERSION::${DOCSY_VERSION}" | |
- name: Add hugo nodejs dependencies | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: 'npm' | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v3 | |
with: | |
# sync versions with docker-compose .env ala | |
# https://github.com/marketplace/actions/hugo-setup#%EF%B8%8F-read-hugo-version-from-file | |
hugo-version: "${{ steps.hugo-version.outputs.HUGO_VERSION }}" | |
extended: true | |
- name: Build Hugo site | |
env: | |
HUGO_ENV: "production" | |
run: | | |
npm install | |
hugo mod get | |
hugo --minify --gc | |
- name: Deploy to Pages | |
if: github.event_name == 'push' | |
uses: peaceiris/actions-gh-pages@v4 | |
env: | |
HUGO_ENV: "production" | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
publish_branch: main |