diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index e4de16a..fc95728 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,4 +1,4 @@ -name: github pages +name: Deploy to GitHub Pages on: workflow_dispatch: @@ -6,11 +6,19 @@ on: branches: - main +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + jobs: - deploy: + build: runs-on: ubuntu-20.04 - concurrency: - group: ${{ github.workflow }}-${{ github.ref }} steps: - uses: actions/checkout@v4 @@ -19,11 +27,25 @@ jobs: with: mdbook-version: 'latest' + - name: Setup Pages + id: pages + uses: actions/configure-pages@v3 + - run: mdbook build - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - if: ${{ github.ref == 'refs/heads/main' }} + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./book + path: ./book + + # Deployment job + deploy: + 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@v2