Skip to content

Commit

Permalink
ci: Add preview cookbook workflow
Browse files Browse the repository at this point in the history
Add a new workflow file to enable previewing the cookbook.

This workflow runs on pull requests and
creates a preview of the cookbook using mdBook.

The preview is then uploaded as an artifact
and a comment is created in the pull request
to notify users.
  • Loading branch information
storopoli committed May 7, 2024
1 parent bd008ad commit 3b29f5e
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/preview-cookbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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.
issues: write
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

0 comments on commit 3b29f5e

Please sign in to comment.