Publishing docs to Github Pages #30
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: 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 }} |