Skip to content
58 changes: 36 additions & 22 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ permissions:
pages: write
id-token: write

concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash
Expand All @@ -49,6 +53,8 @@ env:
# Specify the deployment environment: staging or production
HUGO_ENVIRONMENT: ${{ vars.HUGO_ENVIRONMENT || 'staging' }}
HUGO_VERSION: 0.155.3
# Temporary to validate Node.js 24 works correctly
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
# ----------------------------------------------------------------------------
Expand All @@ -57,27 +63,34 @@ jobs:
#
check:
outputs:
zoteroVersion: ${{ fromJson(steps.zoteroVersion.outputs.headers).last-modified-version }}
cacheHit: ${{ steps.cache-zotero-bib.outputs.cache-hit }}
zoteroVersion: ${{ steps.zoteroVersion.outputs.version }}
cacheHit: ${{ steps.cache-zotero.outputs.cache-hit }}

runs-on: ubuntu-latest
steps:

- name: Get Zotero Version Information
id: zoteroVersion
uses: fjogeleit/http-request-action@v1
with:
url: https://api.zotero.org/groups/2914042/items?format=versions
method: GET

run: |
set -euo pipefail
VERSION=$(curl -fsSLI "https://api.zotero.org/groups/2914042/items?format=versions" \
| grep -i "last-modified-version" \
| cut -d: -f2 \
| tr -d $'\r ' )
if [[ -z "${VERSION:-}" ]]; then
echo "Error: Failed to determine Zotero Last-Modified-Version from API response." >&2
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Cache Zotero Bibliography
id: cache-zotero
uses: actions/cache/restore@v4
uses: actions/cache/restore@v5
with:
lookup-only: true
path: |
content/en/history/bibliography
key: bib-${{ fromJson(steps.zoteroVersion.outputs.headers).last-modified-version }}
key: bib-${{ steps.zoteroVersion.outputs.version }}

# ----------------------------------------------------------------------------
# Validate that README.md references the correct Hugo version.
Expand All @@ -87,7 +100,7 @@ jobs:
if: github.event_name == 'push' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Check Hugo version consistency
run: |
Expand Down Expand Up @@ -121,14 +134,14 @@ jobs:
if: always() && (github.event_name == 'push' || github.event_name == 'pull_request' || needs.check.outputs.cacheHit != 'true') && (needs.validate-docs.result == 'success' || needs.validate-docs.result == 'skipped') && (needs.check.result == 'success' || needs.check.result == 'skipped')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0

- name: Cache Zotero Bibliography
id: cache-bib
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: |
static/data/bibliography.json
Expand All @@ -154,25 +167,26 @@ jobs:

- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
uses: actions/configure-pages@v6.0.0

- name: Setup Node
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: 18

- run: npm install -g autoprefixer --save-dev
- run: npm install -g postcss-cli --save-dev
- run: npm install --verbose
node-version: 24
cache: 'npm'

- name: Install dependencies
run: |
npm ci

- name: Build
env:
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
TZ: America/New York
TZ: America/New_York
run: hugo --cleanDestinationDir -e $HUGO_ENVIRONMENT

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
uses: actions/upload-pages-artifact@v4
with:
path: ./public

Expand All @@ -187,5 +201,5 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v5

Loading