@@ -2,7 +2,7 @@ name: Weekly Documentation Update
22
33on :
44 schedule :
5- # Run every Sunday at 2:00 UTC (only changed pages, minimal update)
5+ # Run every Sunday at 2:00 UTC
66 - cron : ' 0 2 * * 0'
77 workflow_dispatch : # Allow manual trigger
88
@@ -14,13 +14,13 @@ jobs:
1414 update-docs :
1515 name : Update Documentation Index
1616 runs-on : ubuntu-latest
17- timeout-minutes : 60
17+ timeout-minutes : 120 # Increased timeout for full re-index
1818
1919 steps :
2020 - name : Checkout code
2121 uses : actions/checkout@v4
2222 with :
23- ref : prod
23+ ref : dev # Checkout dev branch to commit changes later
2424 fetch-depth : 0
2525 lfs : true
2626
@@ -43,83 +43,58 @@ jobs:
4343 - name : Install dependencies
4444 run : npm ci
4545
46- - name : Update documentation (incremental, with embeddings)
47- run : npm run index-docs -- --incremental --sitemap --embeddings
46+ - name : Get Latest Release Tag
47+ id : get_release
4848 env :
49- # Allow longer timeout for embedding generation
50- NODE_OPTIONS : --max-old-space-size=6144
49+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
50+ run : |
51+ LATEST_TAG=$(gh release list --limit 1 --json tagName --jq '.[0].tagName')
52+ echo "Latest release tag: $LATEST_TAG"
53+ echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT
5154
52- - name : Check for changes
53- id : check_changes
55+ - name : Re-index Documentation (Full Rebuild)
5456 run : |
55- if git diff --quiet data/mcmodding-docs.db 2>/dev/null; then
56- echo "has_changes=false" >> $GITHUB_OUTPUT
57- echo "No documentation changes detected"
58- else
59- echo "has_changes=true" >> $GITHUB_OUTPUT
60- echo "Documentation changes detected"
61- fi
57+ # Remove existing database to ensure a fresh index
58+ rm -f data/mcmodding-docs.db
59+
60+ # Run full index (no incremental flag)
61+ npm run index-docs -- --sitemap --embeddings
62+ env :
63+ # Allow longer timeout and more memory for embedding generation
64+ NODE_OPTIONS : --max-old-space-size=8192
6265
63- - name : Generate database manifest (incremental)
64- if : steps.check_changes.outputs.has_changes == 'true'
66+ - name : Generate New Database Manifest
6567 run : |
66- TIMESTAMP=$(date -u +'%Y.%m.%d')
67- npm run db:manifest -- --version "$TIMESTAMP" --type incremental --changelog "Incremental weekly documentation update"
68+ # Generate manifest with a patch bump
69+ npm run db:manifest -- --bump patch --changelog "Weekly update for $LATEST_TAG" --release-tag "$LATEST_TAG"
70+ env :
71+ LATEST_TAG : ${{ steps.get_release.outputs.tag }}
6872
69- - name : Commit documentation updates
70- if : steps.check_changes.outputs.has_changes == 'true'
73+ - name : Update Release Assets
74+ env :
75+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
76+ TAG : ${{ steps.get_release.outputs.tag }}
7177 run : |
72- git add data/mcmodding-docs.db data/db-manifest.json
73- git commit -m "fix(docs): update documentation index" -m "- Incremental update of documentation pages
74- - Updated embeddings for semantic search
75- - Automated weekly update
78+ echo "Uploading new database assets to release $TAG..."
79+ gh release upload "$TAG" data/mcmodding-docs.db data/db-manifest.json --clobber
7680
77- Generated by: GitHub Actions (update-docs-weekly)"
81+ - name : Commit and Push to Dev
82+ run : |
83+ git add data/mcmodding-docs.db data/db-manifest.json
7884
79- - name : Create Pull Request
80- if : steps.check_changes.outputs.has_changes == 'true'
81- uses : peter-evans/create-pull-request@v5
82- with :
83- commit-message : ' fix(docs): update documentation index'
84- title : ' fix(docs): weekly documentation update'
85- body : |
86- ## Weekly Documentation Update
87-
88- This PR updates the documentation index with the latest content from:
89- - wiki.fabricmc.net
90- - docs.fabricmc.net
91-
92- ### Changes
93- - ✅ Fetched latest documentation pages
94- - ✅ Updated chunks for incremental changes only
95- - ✅ Regenerated semantic embeddings for updated chunks
96- - ✅ Database stored via Git LFS
97- - ✅ No breaking changes
98-
99- ### How to Test
100- ```bash
101- npm run start
102- ```
103-
104- Then test the `search_fabric_docs` and `explain_fabric_concept` tools with recent topics.
105-
106- ---
107- *This is an automated weekly update. No manual action needed.*
108- branch : ' docs/update-${{ github.run_number }}'
109- base : prod
110- delete-branch : true
111- labels : ' documentation,automated'
85+ # Check if there are changes to commit
86+ if git diff --staged --quiet; then
87+ echo "No changes to commit"
88+ else
89+ git commit -m "weekly documentation update [skip ci]"
90+ git push origin dev
91+ fi
11292
11393 - name : Log summary
94+ if : always()
11495 run : |
11596 echo "## Documentation Update Summary" >> $GITHUB_STEP_SUMMARY
11697 echo "" >> $GITHUB_STEP_SUMMARY
117- if [[ "${{ steps.check_changes.outputs.has_changes }}" == "true" ]]; then
118- echo "✅ Documentation index updated with incremental changes" >> $GITHUB_STEP_SUMMARY
119- else
120- echo "ℹ️ No documentation changes detected" >> $GITHUB_STEP_SUMMARY
121- fi
122- echo "" >> $GITHUB_STEP_SUMMARY
123- echo "**Schedule:** Every Sunday at 2:00 UTC" >> $GITHUB_STEP_SUMMARY
124- echo "**Update Type:** Incremental (only changed pages)" >> $GITHUB_STEP_SUMMARY
125- echo "**Embeddings:** Regenerated for changed chunks" >> $GITHUB_STEP_SUMMARY
98+ echo "✅ Full re-index completed" >> $GITHUB_STEP_SUMMARY
99+ echo "✅ Database assets updated in release ${{ steps.get_release.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
100+ echo "✅ Changes committed to dev branch" >> $GITHUB_STEP_SUMMARY
0 commit comments