From e1247faacff7a7a209b5cbe6388aebda0fefd7e7 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 24 Nov 2025 09:19:27 -0800 Subject: [PATCH] Switch docs deployment to use artifact upload This switches from manually pushing to the gh-pages branch to using the GitHub-provided pages upload actions. This is needed because checkout@v6 changed the way git permissions are stored, and instead of bothering trying to work around that, I felt like just switching to this instead. --- .github/workflows/docs.yml | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a467ed8..edaa93c 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -8,9 +8,7 @@ permissions: contents: read jobs: - deploy: - permissions: - contents: write # for Git to git push + build: runs-on: ubuntu-latest env: MDBOOK_VERSION: 0.4.51 @@ -23,18 +21,28 @@ jobs: mkdir mdbook curl -Lf https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook echo `pwd`/mdbook >> $GITHUB_PATH - - name: Deploy docs + - name: Build the book run: | cd guide mdbook build - git worktree add gh-pages - git config user.name "Deploy from CI" - git config user.email "" - cd gh-pages - # Delete the ref to avoid keeping history. - git update-ref -d refs/heads/gh-pages - rm -rf * - mv ../book/* . - git add . - git commit -m "Deploy $GITHUB_SHA to gh-pages" - git push --force --set-upstream origin gh-pages + - name: Upload Artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./guide/book + + deploy: + needs: build + + permissions: + pages: write + id-token: write + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4