Merge pull request #17 from SKalt/dependabot/npm_and_yarn/micromatch-… #37
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
# workflow for building and deploying a static site to GitHub Pages | |
name: Deploy static site to Pages | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["master"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 # see https://github.com/pnpm/action-setup | |
with: | |
version: "9" | |
- name: Setup node.js | |
uses: actions/setup-node@v4 # see https://github.com/actions/setup-node/ | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
cache-dependency-path: ./pnpm-lock.yaml | |
- run: pnpm install --frozen-lockfile | |
- name: spellcheck | |
run: | | |
./node_modules/.bin/cspell \ | |
./README.md \ | |
./**/*.md \ | |
./assets/*.svg \ | |
./assets/critical.css \ | |
./assets/**/*.{ts,js} | |
# - name: Setup Hugo | |
# uses: peaceiris/actions-hugo@v2 | |
# with: | |
# hugo-version: "latest" | |
# patched hugo with upgraded chroma: | |
- name: Setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "^1.22.6" | |
- uses: actions/cache@v4 | |
id: cache-hugo | |
with: | |
path: bin | |
key: hugo-build-${{ runner.os }}-${{ hashFiles('tmp/hugo/go.mod', 'tmp/hugo/go.sum') }} | |
- name: build patched hugo | |
if: steps.cache-hugo.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p tmp bin | |
repo_root=$(pwd) | |
git clone \ | |
--depth 1 \ | |
--branch upgrade-chroma \ | |
https://github.com/SKalt/hugo.git tmp/hugo | |
cd tmp/hugo | |
go build -o "${repo_root}/bin/hugo" | |
cd "$repo_root" | |
- run: echo "$PWD/bin" >> "$GITHUB_PATH" | |
- name: Build the site | |
run: hugo --gc --minify # TODO: cache build? | |
- name: Pagefind | |
run: | | |
./node_modules/.bin/pagefind \ | |
--site ./public \ | |
--root-selector main | |
- name: Check content links | |
uses: lycheeverse/[email protected] | |
with: | |
fail: true | |
args: ./content --verbose --no-progress --insecure --accept 429,403 | |
- name: Check output links | |
uses: lycheeverse/[email protected] | |
with: | |
fail: true | |
args: ./content --verbose --no-progress --insecure --accept 429,403 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 # This will automatically upload an artifact from the '/_site' directory | |
with: | |
path: public | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |