Skip to content

Publishing docs to Github Pages #28

Publishing docs to Github Pages

Publishing docs to Github Pages #28

Workflow file for this run

name: publish-to-github-pages
run-name: Publishing docs to Github Pages
on:
push:
branches: [main]
paths:
- 'docs/**'
- hugo.yaml
- package.json
- package-lock.json
workflow_dispatch:
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci
shell: bash
# install hugo
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.140.0'
extended: true
# build the site
- name: Build
run: hugo --minify
- run: touch public/.nojekyll # this to make Github not treat this as Jekyll
- run: echo 'foxy-contexts.str4.io' > ./public/CNAME
# following I took from gh-pages docs:
- name: Deploy to Github Pages
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
npm run deploy -- -u "github-actions-bot <[email protected]>"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}