ci: single-source the Hugo version via .hugoversion + auto-bump (clos… #49
Workflow file for this run
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: CI | |
| # Validates every push and pull request: a strict Hugo build (warnings fail the | |
| # build) plus an internal link / image / anchor check. Deterministic — no external | |
| # network checks, so it never goes red on a third-party hiccup. | |
| on: | |
| push: | |
| branches-ignore: [main] # main is covered by deploy.yml's build step | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build-and-check: | |
| runs-on: ubuntu-latest | |
| env: | |
| HTMLTEST_VERSION: "0.17.0" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false # zizmor: artipacked | |
| - name: Install Hugo (extended) | |
| run: | | |
| HUGO_VERSION="$(cat .hugoversion)" # single source of truth (see also deploy.yml) | |
| wget -O "${{ runner.temp }}/hugo.deb" \ | |
| "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb" | |
| sudo dpkg -i "${{ runner.temp }}/hugo.deb" | |
| - name: Build (strict — warnings are errors) | |
| env: | |
| HUGO_ENVIRONMENT: production | |
| TZ: UTC | |
| run: hugo --gc --minify --panicOnWarning --baseURL "http://localhost/" | |
| - name: Install htmltest (pinned GitHub release) | |
| run: | | |
| curl -fsSL \ | |
| "https://github.com/wjdp/htmltest/releases/download/v${HTMLTEST_VERSION}/htmltest_${HTMLTEST_VERSION}_linux_amd64.tar.gz" \ | |
| -o "${{ runner.temp }}/htmltest.tar.gz" | |
| tar -xzf "${{ runner.temp }}/htmltest.tar.gz" -C "${{ runner.temp }}" htmltest | |
| install "${{ runner.temp }}/htmltest" /usr/local/bin/htmltest | |
| - name: Check internal links, anchors & images | |
| run: htmltest | |
| format: | |
| name: Format & lint (Prettier + markdownlint) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| persist-credentials: false # zizmor: artipacked | |
| - name: Setup Node | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: "22" | |
| cache: npm | |
| - name: Install toolchain (pinned via package-lock.json) | |
| run: npm ci | |
| - name: Prettier (check mode) | |
| run: npm run format:check | |
| - name: markdownlint | |
| run: npm run lint:md |