Skip to content

ci: Add preview cookbook workflow #1

ci: Add preview cookbook workflow

ci: Add preview cookbook workflow #1

name: preview cookbook
on:
pull_request: {}
workflow_dispatch: null
jobs:
preview-cookbook:
runs-on: ubuntu-latest
permissions:
# For the comment in the PRs saying that the preview is ready.
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
submodules: true # could be useful in the future
fetch-depth: 0 # we just need the latest commit
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: 'latest'
- name: Build mdbook
working-directory: ./cookbook
run: mdbook build
- name: Make preview available
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: cookbook-preview
path: ./cookbook/book
retention-days: 8
- name: Create a comment to say that the artifact is ready
if: ${{ github.event_name == 'pull_request' }}
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.number }}
body: |
The cookbook mdbook was created and uploaded as an artifact. \
You can find it on the GitHub Actions Summary page for the GitHub Actions Runs in this PR.