From 7dd87da7ad18115b4b11af86ca342b7bfef9e833 Mon Sep 17 00:00:00 2001 From: Jon Froehlich Date: Mon, 22 Jun 2026 13:38:59 -0700 Subject: [PATCH] Add GitHub Actions Jekyll build + deploy workflow (#98) Replace the default branch-based GitHub Pages build with an Actions workflow that runs `bundle exec jekyll build` on a clean runner and publishes _site/ via actions/deploy-pages. Keeps the github-pages gem so the built output matches the current site, while unlocking custom plugins, build-time code inlining, and content lint/test gates. Document the new pipeline (and the required Settings -> Pages source switch) in website-dev.md. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/jekyll.yml | 72 ++++++++++++++++++++++++++++++++++++ website-dev.md | 19 ++++++++++ 2 files changed, 91 insertions(+) create mode 100644 .github/workflows/jekyll.yml diff --git a/.github/workflows/jekyll.yml b/.github/workflows/jekyll.yml new file mode 100644 index 00000000..3122e2df --- /dev/null +++ b/.github/workflows/jekyll.yml @@ -0,0 +1,72 @@ +# Build the Jekyll site with GitHub Actions and deploy it to GitHub Pages. +# +# This replaces the default "deploy from a branch" GitHub Pages build (which +# only runs whitelisted plugins and no custom build steps) with a full +# `bundle exec jekyll build` running in CI. That unlocks custom plugins, +# build-time code inlining, and content lint/test gates. See issue #98. +# +# IMPORTANT: this workflow only takes over publishing once the repo's +# Pages "Source" is switched from "Deploy from a branch" to "GitHub Actions" +# (Settings -> Pages -> Build and deployment -> Source). Until then it builds +# but the deploy step will not publish. +name: Build and deploy Jekyll site to Pages + +on: + # Run on every push to the live branch. + push: + branches: ["main"] + # Allow manual runs from the Actions tab. + workflow_dispatch: + +# Minimum permissions the deploy job needs to publish to Pages. +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment; don't cancel an in-progress production +# deploy if another push lands while it's running. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + # Matches .ruby-version. bundler-cache installs the Gemfile (still + # the github-pages gem, so the build is byte-for-byte the current + # one) and caches gems between runs. + ruby-version: "3.3.11" + bundler-cache: true + cache-version: 0 + + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + + - name: Build with Jekyll + # base_path comes out as "/physcomp", matching baseurl in _config.yml. + run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" + env: + JEKYLL_ENV: production + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/website-dev.md b/website-dev.md index ca84e02f..65a6f850 100644 --- a/website-dev.md +++ b/website-dev.md @@ -24,6 +24,25 @@ Assuming you have the prerequisite libraries and software infrastructure (e.g., > bundle exec jekyll serve ``` +## Deployment (GitHub Actions) + +The live site at is built and +published by the GitHub Actions workflow in +[`.github/workflows/jekyll.yml`](.github/workflows/jekyll.yml). On every push to +`main` (and on manual runs from the **Actions** tab), the workflow runs +`bundle exec jekyll build` on a clean Ubuntu runner and deploys the resulting +`_site/` to GitHub Pages with `actions/deploy-pages`. + +This replaced the older "Deploy from a branch" GitHub Pages build, which only +ran whitelisted plugins and no custom build steps. Building in Actions lets us +run custom Jekyll plugins, inline source code at build time, and add content +lint/test gates. See [issue #98](https://github.com/makeabilitylab/physcomp/issues/98). + +For the Actions deploy to publish, the repo's **Settings → Pages → Build and +deployment → Source** must be set to **GitHub Actions** (not "Deploy from a +branch"). The workflow still installs the same `github-pages` gem from the +`Gemfile`, so the built output matches the previous branch-based build. + ## VS Code I've been using [VS Code](https://code.visualstudio.com/) with some popular markdown extensions to develop the website.