Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
build-and-check:
runs-on: ubuntu-latest
env:
HUGO_VERSION: "0.162.1"
HTMLTEST_VERSION: "0.17.0"
steps:
- name: Checkout
Expand All @@ -32,6 +31,7 @@ jobs:

- 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"
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,7 @@ defaults:
jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.162.1
steps:
- name: Install Hugo CLI
run: |
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: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
Expand All @@ -45,6 +38,12 @@ jobs:
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
with:
enablement: true
- name: Install Hugo (extended)
run: |
HUGO_VERSION="$(cat .hugoversion)" # single source of truth (see also ci.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: Refresh release versions (best-effort)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/hugo-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Bump Hugo

# Dependabot can't track the wget-installed Hugo .deb, so this scheduled job checks for a newer
# Hugo release and opens a PR updating .hugoversion — the single source of truth read by both
# ci.yml and deploy.yml. Manual bump: just edit .hugoversion.
#
# Note: PRs opened with the built-in GITHUB_TOKEN don't themselves trigger CI (a GitHub
# limitation), so re-run / push to the bump PR to exercise the strict build before merging.

on:
schedule:
- cron: "0 8 * * 1" # Mondays 08:00 UTC
workflow_dispatch:

permissions:
contents: read

jobs:
bump:
runs-on: ubuntu-latest
permissions:
contents: write # commit the bump on a branch
pull-requests: write # open the PR
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false # zizmor: artipacked
- name: Check for a newer Hugo release
id: check
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
current="$(cat .hugoversion)"
latest="$(gh api repos/gohugoio/hugo/releases/latest --jq '.tag_name' | sed 's/^v//')"
echo "current=$current" >> "$GITHUB_OUTPUT"
echo "latest=$latest" >> "$GITHUB_OUTPUT"
if [ "$current" != "$latest" ]; then
printf '%s\n' "$latest" > .hugoversion
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
- name: Open bump PR
if: steps.check.outputs.changed == 'true'
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: main
branch: chore/bump-hugo
delete-branch: true
labels: infra
commit-message: "ci: bump Hugo ${{ steps.check.outputs.current }} -> ${{ steps.check.outputs.latest }}"
title: "ci: bump Hugo to ${{ steps.check.outputs.latest }}"
body: |
Automated bump of the single-sourced Hugo version in `.hugoversion`:
`${{ steps.check.outputs.current }}` → `${{ steps.check.outputs.latest }}`.

Both `ci.yml` and `deploy.yml` read this file, so the strict build in CI
validates the new version. Re-run CI on this PR (GITHUB_TOKEN-opened PRs
don't auto-trigger it) before merging.
1 change: 1 addition & 0 deletions .hugoversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.162.1
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ You need [Hugo **extended**](https://gohugo.io/installation/) (≥ 0.162). On ma
hugo server # live reload at http://localhost:1313
```

CI and the deploy build pin an exact Hugo version in **[`.hugoversion`](.hugoversion)** — a single
source of truth read by both [`ci.yml`](.github/workflows/ci.yml) and
[`deploy.yml`](.github/workflows/deploy.yml), so they can't drift. Bump it by editing that one file
(a weekly [`hugo-bump.yml`](.github/workflows/hugo-bump.yml) job also opens a PR when a newer Hugo
ships).

## Build

```bash
Expand Down