Skip to content

Commit 65ed96f

Browse files
committed
upgraded to latest Hugo and HugoBlox theme
Signed-off-by: Lars Heinemann <lhein.smx@gmail.com>
1 parent c01645d commit 65ed96f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2309
-883
lines changed

.devcontainer/devcontainer.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "HugoBlox Codespace",
3+
"image": "ghcr.io/HugoBlox/hugo-blox-dev:hugo0.154.5",
4+
"updateContentCommand": "pnpm install --frozen-lockfile --prefer-offline",
5+
"postCreateCommand": "pnpm --version && hugo version",
6+
"customizations": {
7+
"vscode": {
8+
"extensions": [
9+
"hugoblox.hugoblox-studio"
10+
]
11+
}
12+
},
13+
"mounts": [
14+
"source=pnpm-store,target=/home/vscode/.local/share/pnpm,type=volume"
15+
],
16+
"remoteUser": "vscode",
17+
"forwardPorts": [
18+
1313
19+
],
20+
"portsAttributes": {
21+
"1313": {
22+
"label": "Hugo Server"
23+
}
24+
}
25+
}

.github/dependabot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ updates:
44
- package-ecosystem: "github-actions"
55
directory: "/"
66
schedule:
7-
interval: "weekly"
7+
interval: "weekly"

.github/workflows/build.yml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: Build
2+
3+
env:
4+
NODE_VERSION: '20'
5+
6+
on:
7+
# Standalone trigger for PR validation
8+
pull_request:
9+
branches: ['main']
10+
# Reusable workflow trigger - called by deploy.yml
11+
workflow_call:
12+
outputs:
13+
artifact-id:
14+
description: 'The ID of the uploaded artifact'
15+
value: ${{ jobs.build.outputs.artifact-id }}
16+
# Allow manual trigger for testing
17+
workflow_dispatch:
18+
19+
# Read-only permissions for security
20+
permissions:
21+
contents: read
22+
23+
# Prevent duplicate builds for the same PR
24+
concurrency:
25+
group: build-${{ github.head_ref || github.run_id }}
26+
cancel-in-progress: true
27+
28+
jobs:
29+
build:
30+
if: github.repository_owner != 'HugoBlox'
31+
runs-on: ubuntu-latest
32+
timeout-minutes: 10
33+
outputs:
34+
artifact-id: ${{ steps.upload.outputs.artifact-id }}
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
with:
39+
# Fetch history for Hugo's .GitInfo and .Lastmod
40+
fetch-depth: 0
41+
42+
- name: Setup Node.js
43+
uses: actions/setup-node@v6
44+
with:
45+
node-version: ${{ env.NODE_VERSION }}
46+
47+
- name: Setup pnpm
48+
if: hashFiles('package.json') != ''
49+
uses: pnpm/action-setup@v4
50+
51+
- name: Get Hugo Version
52+
id: hugo-version
53+
run: |
54+
# Install pinned yq version for robust YAML parsing
55+
YQ_VERSION="v4.44.1"
56+
if ! wget -q --tries=3 --waitretry=1 -O /tmp/yq \
57+
"https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64"; then
58+
echo "::error::Failed to download yq"
59+
exit 1
60+
fi
61+
sudo mv /tmp/yq /usr/local/bin/yq
62+
sudo chmod +x /usr/local/bin/yq
63+
64+
# Read hugo_version from hugoblox.yaml
65+
VERSION=$(yq '.hugo_version // ""' hugoblox.yaml 2>/dev/null | grep -v '^null$' || true)
66+
67+
# Fallback to a known stable version if not specified
68+
DEFAULT_VERSION="0.154.5"
69+
VERSION=${VERSION:-$DEFAULT_VERSION}
70+
71+
# Validate version format (basic check)
72+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
73+
echo "::warning::Invalid hugo_version format '$VERSION', using default $DEFAULT_VERSION"
74+
VERSION="$DEFAULT_VERSION"
75+
fi
76+
77+
echo "HUGO_VERSION=$VERSION" >> $GITHUB_ENV
78+
echo "Using Hugo version: $VERSION"
79+
80+
- name: Install dependencies
81+
run: |
82+
# Install Tailwind CLI if package.json exists
83+
if [ -f "package.json" ]; then
84+
echo "Installing Tailwind dependencies..."
85+
pnpm install --no-frozen-lockfile || npm install
86+
fi
87+
88+
- name: Setup Hugo
89+
uses: peaceiris/actions-hugo@v3
90+
with:
91+
hugo-version: ${{ env.HUGO_VERSION }}
92+
extended: true
93+
94+
# Cache dependencies (Go modules, node_modules) - stable, rarely changes
95+
- uses: actions/cache@v4
96+
with:
97+
path: |
98+
/tmp/hugo_cache_runner/
99+
node_modules/
100+
modules/*/node_modules/
101+
key: ${{ runner.os }}-hugo-deps-${{ hashFiles('**/go.mod', '**/package-lock.json',
102+
'**/pnpm-lock.yaml') }}
103+
restore-keys: |
104+
${{ runner.os }}-hugo-deps-
105+
106+
# Cache Hugo resources (processed images, CSS) - invalidates only when assets/config change
107+
- uses: actions/cache@v4
108+
with:
109+
path: resources/
110+
key: ${{ runner.os }}-hugo-resources-${{ hashFiles('assets/**/*', 'config/**/*',
111+
'hugo.yaml', 'package.json') }}
112+
restore-keys: |
113+
${{ runner.os }}-hugo-resources-
114+
115+
- name: Build with Hugo
116+
env:
117+
HUGO_ENVIRONMENT: production
118+
HUGO_BLOX_LICENSE: ${{ secrets.HUGO_BLOX_LICENSE }}
119+
run: |
120+
echo "Hugo Cache Dir: $(hugo config | grep cachedir)"
121+
hugo --minify
122+
123+
- name: Generate Pagefind search index (if applicable)
124+
run: |
125+
# Check if site uses Pagefind search
126+
if [ -f "package.json" ] && grep -q "pagefind" package.json; then
127+
pnpm run pagefind || npx pagefind --site "public"
128+
fi
129+
130+
- name: Upload artifact
131+
id: upload
132+
uses: actions/upload-pages-artifact@v4
133+
with:
134+
path: ./public
135+
136+
- name: Setup CNAME correctly
137+
run: |
138+
cp CNAME public/CNAME

.github/workflows/deploy.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Deploy website to GitHub Pages
2+
3+
on:
4+
# Trigger the workflow every time you push to the `main` branch
5+
push:
6+
branches: ['main']
7+
# Allows you to run this workflow manually from the Actions tab on GitHub
8+
workflow_dispatch:
9+
10+
# Provide permission to clone the repo and deploy it to GitHub Pages
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: 'pages'
18+
cancel-in-progress: false
19+
20+
jobs:
21+
# Check deployment configuration
22+
config:
23+
if: github.repository_owner != 'HugoBlox'
24+
runs-on: ubuntu-latest
25+
outputs:
26+
deploy-host: ${{ steps.check.outputs.host }}
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
sparse-checkout: hugoblox.yaml
32+
sparse-checkout-cone-mode: false
33+
34+
- name: Check deploy host
35+
id: check
36+
run: |
37+
# Install pinned yq version for robust YAML parsing
38+
YQ_VERSION="v4.44.1"
39+
if ! wget -q --tries=3 --waitretry=1 -O /tmp/yq \
40+
"https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64"; then
41+
echo "::error::Failed to download yq"
42+
exit 1
43+
fi
44+
sudo mv /tmp/yq /usr/local/bin/yq
45+
sudo chmod +x /usr/local/bin/yq
46+
47+
# Read deploy.host from hugoblox.yaml, default to github-pages
48+
HOST=$(yq '.deploy.host // ""' hugoblox.yaml 2>/dev/null | grep -v '^null$' || true)
49+
HOST=${HOST:-github-pages}
50+
51+
# Validate known hosts
52+
if [[ ! "$HOST" =~ ^(github-pages|netlify|vercel|cloudflare|none)$ ]]; then
53+
echo "::warning::Unknown deploy host '$HOST', defaulting to github-pages"
54+
HOST="github-pages"
55+
fi
56+
57+
echo "host=$HOST" >> $GITHUB_OUTPUT
58+
echo "Deployment target: $HOST"
59+
60+
# Build website using reusable workflow (always runs for CI)
61+
build:
62+
needs: config
63+
if: github.repository_owner != 'HugoBlox'
64+
uses: ./.github/workflows/build.yml
65+
secrets: inherit
66+
67+
# Deploy website to GitHub Pages hosting (only if configured)
68+
deploy:
69+
needs: [config, build]
70+
if: needs.config.outputs.deploy-host == 'github-pages'
71+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
72+
permissions:
73+
pages: write # to deploy to Pages
74+
id-token: write # to verify the deployment originates from an appropriate source
75+
# Deploy to the github-pages environment
76+
environment:
77+
name: github-pages
78+
url: ${{ steps.deployment.outputs.page_url }}
79+
runs-on: ubuntu-latest
80+
steps:
81+
- name: Deploy to GitHub Pages
82+
id: deployment
83+
uses: actions/deploy-pages@v4
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
build:
2323
runs-on: ubuntu-latest
2424
env:
25-
HUGO_VERSION: 0.127.0
25+
HUGO_VERSION: 0.154.5
2626
steps:
2727
- name: Install Hugo CLI
2828
run: |
@@ -51,6 +51,7 @@ jobs:
5151
HUGO_ENVIRONMENT: production
5252
HUGO_ENV: production
5353
TZ: America/Los_Angeles
54+
HUGO_BLOX_LICENSE: ${{ secrets.HUGO_BLOX_LICENSE }}
5455
run: |
5556
hugo \
5657
--gc \
@@ -70,4 +71,4 @@ jobs:
7071
target_branch: public
7172
build_dir: public
7273
env:
73-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pr_build.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)