Upgrade gb-asm-tutorial to use mdbook 0.5 #588
Workflow file for this run
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: Build and deploy an updated version of the website | |
| on: [push, pull_request] | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| env: | |
| MDBOOK_VERSION: 0.5.2 | |
| MDBOOK_LINKCHECK2_VERSION: 0.12.0 | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Checkout gb-asm-tutorial | |
| uses: actions/checkout@v2 | |
| with: | |
| path: gb-asm-tutorial | |
| - name: Install mdbook dependencies | |
| run: | | |
| cargo install mdbook@${MDBOOK_VERSION} | |
| cargo install mdbook-linkcheck2@${MDBOOK_LINKCHECK2_VERSION} | |
| - name: Install static-sitemap-cli | |
| run: npm install static-sitemap-cli | |
| - name: Cache build dir | |
| uses: actions/cache@v4 | |
| with: | |
| path: gb-asm-tutorial/target/ | |
| key: ${{ runner.os }}-build-${{ hashFiles('gb-asm-tutorial/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-build- | |
| - name: Build | |
| working-directory: gb-asm-tutorial/ | |
| env: | |
| MDBOOK_BUILD__CREATE_MISSING: "false" # Prevent creating missing files in SUMMARY.md | |
| MDBOOK_OUTPUT__LINKCHECK2__OPTIONAL: "false" | |
| run: | | |
| mdbook build | |
| for f in po/*.po; do | |
| lang=$(basename -s .po "$f") | |
| MDBOOK_BOOK__LANGUAGE="$lang" mdbook build -d book/"$lang" | |
| mv book/"$lang"/custom book/custom/"$lang" | |
| done | |
| - name: Generate sitemap | |
| run: | | |
| cd gb-asm-tutorial/book/custom/ | |
| npx sscli --no-clean --base https://gbdev.io/gb-asm-tutorial | |
| - name: Store final build | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: gb-asm-tutorial/book/custom/ | |
| deploy: | |
| name: Deploy to GitHub pages | |
| # Do not run this unless *pushing* to `master`. | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |