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