Browse Source

CI: Test Jekyll documentation build in PRs (#9653)

To avoid breaking the CI after a merge, example of breakage: https://github.com/FreshRSS/FreshRSS/pull/9509 ([relevant run](https://github.com/FreshRSS/FreshRSS/actions/runs/41317221948/job/124879715769)).
Inverle 1 day ago
parent
commit
df77842587
1 changed files with 21 additions and 14 deletions
  1. 21 14
      .github/workflows/docs-build-deploy.yml

+ 21 - 14
.github/workflows/jekyll-gh-pages.yml → .github/workflows/docs-build-deploy.yml

@@ -1,32 +1,35 @@
-# Workflow for building and deploying a Jekyll site to GitHub Pages
-name: Deploy Jekyll with GitHub Pages dependencies preinstalled
+name: Build & deploy Jekyll documentation
 
 
 on:
 on:
-  # Runs on pushes targeting the default branch
+  # Runs on pushes and PRs targeting the default branch
   push:
   push:
     branches: ["edge"]
     branches: ["edge"]
     paths:
     paths:
       - 'docs/**'
       - 'docs/**'
+      - '.github/workflows/docs-build-deploy.yml'
+  pull_request:
+    branches: ["edge"]
+    paths:
+      - 'docs/**'
+      - '.github/workflows/docs-build-deploy.yml'
 
 
-  # Allows you to run this workflow manually from the Actions tab
+  # Allows you to run this workflow manually from the Actions tab (deploy)
   workflow_dispatch:
   workflow_dispatch:
 
 
 permissions: {}
 permissions: {}
 
 
-# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
-# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
 concurrency:
 concurrency:
-  group: "pages"
+  group: docs-build-deploy-${{ github.ref }}
   cancel-in-progress: false
   cancel-in-progress: false
 
 
 jobs:
 jobs:
-  # Build job
+  # Build job (the only job that runs in PRs to test the build)
   build:
   build:
     name: build
     name: build
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-26.04
     permissions:
     permissions:
       contents: read
       contents: read
-      pages: write # For preparing the page deployment
+      pages: read # For the "Setup Pages" step
     steps:
     steps:
       - name: Checkout
       - name: Checkout
         uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
         uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -34,27 +37,31 @@ jobs:
           persist-credentials: false
           persist-credentials: false
       - name: Setup Ruby
       - name: Setup Ruby
         uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
         uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
+        env:
+          BUNDLE_FROZEN: true # Always respect Gemfile.lock (explicit)
         with:
         with:
           ruby-version: '3.4.9'
           ruby-version: '3.4.9'
           bundler-cache: true # runs 'bundle install' and caches installed gems automatically
           bundler-cache: true # runs 'bundle install' and caches installed gems automatically
           cache-version: 1 # Increment this number if you need to re-download cached gems
           cache-version: 1 # Increment this number if you need to re-download cached gems
           working-directory: docs
           working-directory: docs
-      - name: Setup Pages
-        uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
       - name: Build with Jekyll
       - name: Build with Jekyll
         run: |
         run: |
           cd docs
           cd docs
           bundle exec jekyll build --destination ../_site
           bundle exec jekyll build --destination ../_site
+      - name: Setup Pages
+        uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
+        if: ${{ github.ref == 'refs/heads/edge' }}
       - name: Upload artifact
       - name: Upload artifact
         uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
         uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
 
 
-  # Deployment job
+  # Deployment job (skipped in PRs)
   deploy:
   deploy:
     name: deploy
     name: deploy
+    if: ${{ github.ref == 'refs/heads/edge' }}
     environment:
     environment:
       name: github-pages
       name: github-pages
       url: ${{ steps.deployment.outputs.page_url }}
       url: ${{ steps.deployment.outputs.page_url }}
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-26.04
     permissions:
     permissions:
       pages: write # For deploying the page
       pages: write # For deploying the page
       id-token: write # For authorizing the deployment
       id-token: write # For authorizing the deployment