Skip to content

Commit

Permalink
use upload pages artifact instead of writing to gh-pages branch (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
AshleyDumaine authored Feb 20, 2024
1 parent a710204 commit e44b0cd
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,39 @@ on:
paths:
- 'README.md'
- 'docs/book/**'
pull_request:
paths:
- 'README.md'
- 'docs/book/**'

permissions:
contents: 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/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 e44b0cd

Please sign in to comment.