Skip to content

Commit

Permalink
use upload pages artifact instead of writing to gh-pages branch
Browse files Browse the repository at this point in the history
  • Loading branch information
AshleyDumaine committed Feb 20, 2024
1 parent e6e7354 commit f9f0eff
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,40 @@ on:
paths:
- 'README.md'
- 'docs/book/**'
workflow_dispatch:

permissions:
content: read
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

jobs:
deploy:
generate-docs:
runs-on: ubuntu-latest
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment

permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

timeout-minutes: 2
steps:
- uses: actions/checkout@v4

- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: '0.4.35'

- run: cd docs/book && mdbook build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build with mdBook
run: cd docs/book && mdbook build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/book
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
path: 'docs/book'

deploy-page:
needs: generate-docs
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit f9f0eff

Please sign in to comment.