From 3b29f5e6930d35c53fb65009583972bae1a1d3d6 Mon Sep 17 00:00:00 2001 From: Jose Storopoli Date: Sat, 4 May 2024 08:22:16 +0000 Subject: [PATCH] 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. --- .github/workflows/preview-cookbook.yml | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/preview-cookbook.yml diff --git a/.github/workflows/preview-cookbook.yml b/.github/workflows/preview-cookbook.yml new file mode 100644 index 0000000..2607d8e --- /dev/null +++ b/.github/workflows/preview-cookbook.yml @@ -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