From 1686a018a92e33e70db50661eed0714b59d3d2cd Mon Sep 17 00:00:00 2001 From: Mike Nelson Date: Mon, 13 Apr 2026 17:06:15 -0500 Subject: [PATCH 1/2] 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. --- .github/workflows/hugo.yml | 61 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/.github/workflows/hugo.yml b/.github/workflows/hugo.yml index 39f28f1b0..91c45c4d7 100644 --- a/.github/workflows/hugo.yml +++ b/.github/workflows/hugo.yml @@ -15,7 +15,7 @@ jobs: build-and-deploy: runs-on: ubuntu-latest env: - HUGO_VERSION: 0.121.0 + HUGO_VERSION: 0.128.0 steps: - name: Install Hugo CLI run: | @@ -39,8 +39,63 @@ jobs: npm install fi - - name: Create data directory - run: mkdir -p data + - name: Create required directories + run: | + mkdir -p data + mkdir -p content/discord + mkdir -p static/discord + + # ----------------------------------------------------------------------- + # Discord Mirror Export + # Runs before Hugo so generated content/discord/ pages are present at + # build time. Skipped on pull requests (no access to secrets) and when + # the bot token is absent, so forks and draft PRs still build cleanly. + # ----------------------------------------------------------------------- + - name: Export Discord mirror content + if: github.event_name != 'pull_request' && env.DISCORD_BOT_TOKEN != '' + env: + DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }} + run: | + echo "Running Discord mirror export..." + pwsh -NonInteractive -File tools/discord-mirror/Export-DiscordMirror.ps1 \ + -ConfigPath config/discord-mirror.json \ + -BotToken "$DISCORD_BOT_TOKEN" + + - name: Verify Discord export output + if: github.event_name != 'pull_request' && env.DISCORD_BOT_TOKEN != '' + env: + DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }} + run: | + echo "=== content/discord/ ===" + find content/discord -type f | sort || echo "(empty)" + echo "=== static/discord/ ===" + find static/discord -type f | sort || echo "(empty)" + echo "=== search index record count ===" + 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)" + + # ----------------------------------------------------------------------- + # Fallback: if the export was skipped (PR or missing token), ensure Hugo + # has a valid _index.md so the /discord/ route doesn't 404 on a clean + # build. Real content will be present on main branch builds. + # ----------------------------------------------------------------------- + - name: Write Discord section placeholder (PR / no-token builds only) + if: github.event_name == 'pull_request' || env.DISCORD_BOT_TOKEN == '' + run: | + if [ ! -f content/discord/_index.md ]; then + cat > content/discord/_index.md << 'EOF' + --- + title: "Discord Archive" + description: "Selected Discord content mirrored for public search and discovery." + layout: single + draft: false + --- + Discord archive content is generated during the main branch build. + EOF + fi + + # ----------------------------------------------------------------------- + # Community stats (Discourse) + # ----------------------------------------------------------------------- - name: Update community stats run: | From 49da79ba3344530aecad15ee8878acfd3518382f Mon Sep 17 00:00:00 2001 From: Mike Nelson Date: Mon, 13 Apr 2026 17:14:48 -0500 Subject: [PATCH 2/2] Update GitHub Actions workflow for Hugo deployment --- .github/workflows/hugo.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/hugo.yml b/.github/workflows/hugo.yml index 91c45c4d7..8ac9c2ff5 100644 --- a/.github/workflows/hugo.yml +++ b/.github/workflows/hugo.yml @@ -201,22 +201,20 @@ jobs: run: touch docs/.nojekyll - name: Commit and push to main + if: github.event_name == 'push' && github.ref == 'refs/heads/main' run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - - # Add files that exist + git add docs/ || echo "No docs directory to add" - - # Only add data files if they exist + if [ -f data/community_stats.json ]; then git add data/community_stats.json fi - - # Only commit if there are changes + if ! git diff --staged --quiet; then git commit -m "Deploy Hugo site to docs/ [skip ci]" - git push + git push origin HEAD:main else echo "No changes to commit" fi