Skip to content

Commit 1686a01

Browse files
Upgrade Hugo version and create Discord export setup
Updated Hugo version from 0.121.0 to 0.128.0, and added required directories for Discord mirror export.
1 parent 641b72e commit 1686a01

1 file changed

Lines changed: 58 additions & 3 deletions

File tree

.github/workflows/hugo.yml

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
build-and-deploy:
1616
runs-on: ubuntu-latest
1717
env:
18-
HUGO_VERSION: 0.121.0
18+
HUGO_VERSION: 0.128.0
1919
steps:
2020
- name: Install Hugo CLI
2121
run: |
@@ -39,8 +39,63 @@ jobs:
3939
npm install
4040
fi
4141
42-
- name: Create data directory
43-
run: mkdir -p data
42+
- name: Create required directories
43+
run: |
44+
mkdir -p data
45+
mkdir -p content/discord
46+
mkdir -p static/discord
47+
48+
# -----------------------------------------------------------------------
49+
# Discord Mirror Export
50+
# Runs before Hugo so generated content/discord/ pages are present at
51+
# build time. Skipped on pull requests (no access to secrets) and when
52+
# the bot token is absent, so forks and draft PRs still build cleanly.
53+
# -----------------------------------------------------------------------
54+
- name: Export Discord mirror content
55+
if: github.event_name != 'pull_request' && env.DISCORD_BOT_TOKEN != ''
56+
env:
57+
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
58+
run: |
59+
echo "Running Discord mirror export..."
60+
pwsh -NonInteractive -File tools/discord-mirror/Export-DiscordMirror.ps1 \
61+
-ConfigPath config/discord-mirror.json \
62+
-BotToken "$DISCORD_BOT_TOKEN"
63+
64+
- name: Verify Discord export output
65+
if: github.event_name != 'pull_request' && env.DISCORD_BOT_TOKEN != ''
66+
env:
67+
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
68+
run: |
69+
echo "=== content/discord/ ==="
70+
find content/discord -type f | sort || echo "(empty)"
71+
echo "=== static/discord/ ==="
72+
find static/discord -type f | sort || echo "(empty)"
73+
echo "=== search index record count ==="
74+
python3 -c "import json,sys; d=json.load(open('static/discord/search-index.json')); print(f'{len(d)} records')" 2>/dev/null || echo "(unreadable or empty)"
75+
76+
# -----------------------------------------------------------------------
77+
# Fallback: if the export was skipped (PR or missing token), ensure Hugo
78+
# has a valid _index.md so the /discord/ route doesn't 404 on a clean
79+
# build. Real content will be present on main branch builds.
80+
# -----------------------------------------------------------------------
81+
- name: Write Discord section placeholder (PR / no-token builds only)
82+
if: github.event_name == 'pull_request' || env.DISCORD_BOT_TOKEN == ''
83+
run: |
84+
if [ ! -f content/discord/_index.md ]; then
85+
cat > content/discord/_index.md << 'EOF'
86+
---
87+
title: "Discord Archive"
88+
description: "Selected Discord content mirrored for public search and discovery."
89+
layout: single
90+
draft: false
91+
---
92+
Discord archive content is generated during the main branch build.
93+
EOF
94+
fi
95+
96+
# -----------------------------------------------------------------------
97+
# Community stats (Discourse)
98+
# -----------------------------------------------------------------------
4499

45100
- name: Update community stats
46101
run: |

0 commit comments

Comments
 (0)