Deploy VitePress site to Pages #30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy VitePress site to Pages | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * *" | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 # needed for lastUpdated git timestamps | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build VitePress site | |
| run: pnpm build | |
| - name: Resolve upstream static site versions | |
| id: static_sites | |
| run: node ci/scripts/resolve-static-sites.mjs | |
| # Restore cached static site trees (skipped when contentHash changes). | |
| - name: Restore field-guide-modern static site cache | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: .vitepress/dist/modern/field-guide | |
| key: wiki-static-field-guide-modern-${{ steps.static_sites.outputs.field_guide_modern_content_hash }} | |
| fail-on-cache-miss: false | |
| - name: Restore recipe-book-modern static site cache | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: .vitepress/dist/modern/recipe-book | |
| key: wiki-static-recipe-book-modern-${{ steps.static_sites.outputs.recipe_book_modern_content_hash }} | |
| fail-on-cache-miss: false | |
| - name: Restore quest-book-modern static site cache | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: .vitepress/dist/modern/quest-book | |
| key: wiki-static-quest-book-modern-${{ steps.static_sites.outputs.quest_book_modern_content_hash }} | |
| fail-on-cache-miss: false | |
| - name: Install aggregated static sites | |
| id: mirror | |
| run: bash ci/mirror-static-sites.sh | |
| # Per-site sitemap.xml (field-guide, quest-book when published) is merged into wiki sitemap. | |
| - name: Merge static site sitemaps | |
| run: node ci/scripts/merge-sitemaps.mjs | |
| - name: Merge field guide into wiki search index | |
| run: node ci/scripts/merge-field-guide-search.mjs | |
| # Quest book search links use ?lang=&chapter=&quest= (not #quest=). | |
| - name: Merge quest book into wiki search index | |
| run: node ci/scripts/merge-quest-book-search.mjs | |
| - name: Save field-guide-modern static site cache | |
| if: steps.mirror.outputs.field_guide_modern_downloaded == 'true' | |
| uses: actions/cache/save@v5 | |
| with: | |
| path: .vitepress/dist/modern/field-guide | |
| key: wiki-static-field-guide-modern-${{ steps.static_sites.outputs.field_guide_modern_content_hash }} | |
| - name: Save recipe-book-modern static site cache | |
| if: steps.mirror.outputs.recipe_book_modern_downloaded == 'true' | |
| uses: actions/cache/save@v5 | |
| with: | |
| path: .vitepress/dist/modern/recipe-book | |
| key: wiki-static-recipe-book-modern-${{ steps.static_sites.outputs.recipe_book_modern_content_hash }} | |
| - name: Save quest-book-modern static site cache | |
| if: steps.mirror.outputs.quest_book_modern_downloaded == 'true' | |
| uses: actions/cache/save@v5 | |
| with: | |
| path: .vitepress/dist/modern/quest-book | |
| key: wiki-static-quest-book-modern-${{ steps.static_sites.outputs.quest_book_modern_content_hash }} | |
| - uses: actions/configure-pages@v5 | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: .vitepress/dist | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@v4 |