Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@
"name": "Jekyll",
"image": "mcr.microsoft.com/devcontainers/jekyll",
"features": {
// The devcontainers/jekyll comes with the wrong Ruby version
"ghcr.io/devcontainers/features/ruby:1": {
"version": "3.3"
// Install rbenv (no Ruby yet); postCreateCommand installs the version from .ruby-version
"ghcr.io/devcontainers/features/ruby:2": {
"version": "none",
"versionManager": "rbenv"
},
// Install latest stable Node (we use for validation scripts after build)
"ghcr.io/devcontainers/features/node:1": {
"version": "lts",
"installYarnUsingApt": false // We use Yarn 4, so we don't want to install Yarn using apt
// Install nvm (no Node yet); postCreateCommand installs the version from .nvmrc
"ghcr.io/devcontainers/features/node:2": {
"version": "none",
"pnpmVersion": "none", // We use Yarn 4 via Corepack
"installYarnUsingApt": false // We use Yarn 4 via Corepack
}
},
"postCreateCommand": "/bin/sh -c 'corepack enable && corepack pack && yarn install --immutable'",
// Ruby and Node versions come from .ruby-version and .nvmrc (single source of truth, shared with CI)
"postCreateCommand": "/bin/bash -c 'set -e; rbenv install --skip-existing; rbenv rehash; source \"$NVM_DIR/nvm.sh\"; nvm install; nvm use; npm install -g corepack; corepack enable; corepack prepare yarn@4.18.0 --activate; yarn install --immutable; bundle install'",
"customizations": {
"vscode": {
"extensions": ["html-validate.vscode-html-validate"]
Expand Down
37 changes: 21 additions & 16 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,29 @@ jobs:
name: Jekyll build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v7
- name: Setup Ruby # See https://www.ruby-lang.org/en/downloads/branches/
uses: ruby/setup-ruby@v1
with:
# Match Ruby version from https://github.com/github/pages-gem/blob/master/.ruby-version
ruby-version: 3.3 # Not needed with a .ruby-version file
ruby-version: .ruby-version # Kept in sync with https://pages.github.com/versions.json
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Build site
run: bundle exec jekyll build

# Installing Node + modern Yarn on GitHub Actions requires hack
# https://github.com/actions/setup-node/issues/531#issuecomment-2960522861
- name: Install Node.js
uses: actions/setup-node@v5
uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
package-manager-cache: false
- name: Enable Corepack
run: corepack enable
run: |
if ! command -v corepack >/dev/null 2>&1; then npm install -g corepack; fi
corepack enable
corepack prepare yarn@4.18.0 --activate
- name: Configure dependency cache
uses: actions/setup-node@v5
uses: actions/setup-node@v7
with:
cache: yarn
- name: Install dependencies
Expand All @@ -56,11 +58,11 @@ jobs:
SITE_URL: ${{ github.event.repository.name == format('{0}.github.io', github.repository_owner) && format('https://{0}.github.io', github.repository_owner) || format('https://{0}.github.io/{1}', github.repository_owner, github.event.repository.name) }}
run: yarn build:sitemap
- name: Upload build artifact, ready for GitHub Pages deployment
uses: actions/upload-pages-artifact@v4
uses: actions/upload-pages-artifact@v5
with:
path: build/
- name: Upload build artifact, ready for testing
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: build-artifact
path: build/ # the Jekyll build directory
Expand All @@ -72,31 +74,34 @@ jobs:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v7

# Installing Node + modern Yarn on GitHub Actions requires hack
# https://github.com/actions/setup-node/issues/531#issuecomment-2960522861
- name: Install Node.js
uses: actions/setup-node@v5
uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
package-manager-cache: false
- name: Enable Corepack
run: corepack enable
run: |
if ! command -v corepack >/dev/null 2>&1; then npm install -g corepack; fi
corepack enable
corepack prepare yarn@4.18.0 --activate
- name: Configure dependency cache
uses: actions/setup-node@v5
uses: actions/setup-node@v7
with:
cache: yarn
- name: Install dependencies
run: yarn install --immutable

- name: Download build artifact
uses: actions/download-artifact@v5
uses: actions/download-artifact@v8
with:
name: build-artifact
path: build/
- name: Restore testing cache
uses: actions/cache/restore@v4
uses: actions/cache/restore@v6
with:
path: cache/
key: test-cache
Expand All @@ -105,7 +110,7 @@ jobs:
- name: Test suite
run: yarn run test
- name: Save testing cache
uses: actions/cache/save@v4
uses: actions/cache/save@v6
if: always()
with:
path: cache/
Expand All @@ -123,4 +128,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v5
22 changes: 14 additions & 8 deletions .github/workflows/code-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v7
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}

# Installing Node + modern Yarn on GitHub Actions requires hack
# https://github.com/actions/setup-node/issues/531#issuecomment-2960522861
- name: Install Node.js
uses: actions/setup-node@v5
uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
package-manager-cache: false
- name: Enable Corepack
run: corepack enable
run: |
if ! command -v corepack >/dev/null 2>&1; then npm install -g corepack; fi
corepack enable
corepack prepare yarn@4.18.0 --activate
- name: Configure dependency cache
uses: actions/setup-node@v5
uses: actions/setup-node@v7
with:
cache: yarn
- name: Install dependencies
Expand All @@ -42,21 +45,24 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v7
with:
ref: ${{ github.head_ref }}

# Installing Node + modern Yarn on GitHub Actions requires hack
# https://github.com/actions/setup-node/issues/531#issuecomment-2960522861
- name: Install Node.js
uses: actions/setup-node@v5
uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
package-manager-cache: false
- name: Enable Corepack
run: corepack enable
run: |
if ! command -v corepack >/dev/null 2>&1; then npm install -g corepack; fi
corepack enable
corepack prepare yarn@4.18.0 --activate
- name: Configure dependency cache
uses: actions/setup-node@v5
uses: actions/setup-node@v7
with:
cache: yarn
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/*
v26
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.4
7 changes: 7 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
approvedGitRepositories:
- "**"

# This makes better-sqlite3 work on GitHub Actions
enableScripts: true

npmMinimalAgeGate: 0
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ Use VS Code and the [Dev Containers extension](https://marketplace.visualstudio.

Or if you do not want VS Code or the Docker setup, install your environment manually:

1. Install Ruby (use version in [build-test-deploy.yml](https://github.com/fulldecent/github-pages-template/blob/main/.github/workflows/build-test-deploy.yml) in "Setup Ruby", (try [rbenv](https://github.com/rbenv/rbenv))
1. Install Ruby to match GitHub Pages. The version is pinned in [.ruby-version](.ruby-version). On Mac, use [rbenv](https://github.com/rbenv/rbenv), which reads that file automatically:

```sh
brew install rbenv
rbenv install # installs the Ruby version from .ruby-version
eval "$(rbenv init -)" # activate rbenv now
```

2. Install Jekyll:

Expand Down Expand Up @@ -107,6 +113,12 @@ Also you can run this to update your environment to match the GitHub Pages (no P
bundle update --conservative # "--consersative" ignores updates that GitHub Pages is not using
```

Keep [.ruby-version](.ruby-version) matching [the Ruby that GitHub Pages runs](https://pages.github.com/versions/) (used by CI, the dev container, and rbenv locally):

```sh
curl -s https://pages.github.com/versions.json | jq -r .ruby > .ruby-version # Send PR if changed
```

## References

1. This website is built based on [best practices documented in github-pages-template](https://github.com/fulldecent/github-pages-template).
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
],
"license": "UNLICENSED",
"devDependencies": {
"@fulldecent/nice-checkers-plugin": "^1.2.1",
"@shopify/prettier-plugin-liquid": "^1.10.0",
"cheerio": "^1.1.2",
"@fulldecent/nice-checkers-plugin": "^1.3.7",
"@shopify/prettier-plugin-liquid": "^1.11.0",
"cheerio": "^1.2.0",
"css": "^3.0.0",
"glob": "^13.0.0",
"html-validate": "^10.4.0",
"markdownlint-cli2": "^0.20.0",
"prettier": "^3.7.4"
"glob": "^13.0.6",
"html-validate": "^11.6.0",
"markdownlint-cli2": "^0.23.2",
"prettier": "^3.9.6"
},
"scripts": {
"lint": "sh -c 'yarn lint:prettier \"$@\" && yarn lint:markdown \"$@\"' --",
Expand All @@ -55,7 +55,7 @@
"test:unused-assets": "node test/unused-assets.mjs",
"postinstall": "yarn dlx @yarnpkg/sdks vscode"
},
"packageManager": "yarn@4.12.0",
"packageManager": "yarn@4.18.0",
"dependencies": {
"front-matter": "^4.0.2",
"xml2js": "^0.6.2"
Expand Down
Loading