Skip to content

Commit 3b29f5e

Browse files
committed
ci: Add preview cookbook workflow
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.
1 parent bd008ad commit 3b29f5e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: preview cookbook
2+
3+
on:
4+
pull_request: {}
5+
workflow_dispatch: null
6+
7+
jobs:
8+
preview-cookbook:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
# For the comment in the PRs saying that the preview is ready.
12+
issues: write
13+
pull-requests: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
submodules: true # could be useful in the future
18+
fetch-depth: 0 # we just need the latest commit
19+
20+
- name: Setup mdBook
21+
uses: peaceiris/actions-mdbook@v2
22+
with:
23+
mdbook-version: 'latest'
24+
25+
- name: Build mdbook
26+
working-directory: ./cookbook
27+
run: mdbook build
28+
29+
- name: Make preview available
30+
if: ${{ github.event_name == 'pull_request' }}
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: cookbook-preview
34+
path: ./cookbook/book
35+
retention-days: 8

0 commit comments

Comments
 (0)