|
15 | 15 | build-and-deploy: |
16 | 16 | runs-on: ubuntu-latest |
17 | 17 | env: |
18 | | - HUGO_VERSION: 0.121.0 |
| 18 | + HUGO_VERSION: 0.128.0 |
19 | 19 | steps: |
20 | 20 | - name: Install Hugo CLI |
21 | 21 | run: | |
|
39 | 39 | npm install |
40 | 40 | fi |
41 | 41 | |
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 | + # ----------------------------------------------------------------------- |
44 | 99 |
|
45 | 100 | - name: Update community stats |
46 | 101 | run: | |
|
0 commit comments