ci: schedule guarded GitHub Pages publishing
Publish GitHub Pages output / publish (push) Has been cancelled
Publish GitHub Pages output / publish (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
name: Publish GitHub Pages output
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
schedule:
|
||||
- cron: '*/5 * * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: publish-github-pages
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Use Node.js 24
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Check publication time
|
||||
id: publication
|
||||
shell: bash
|
||||
run: |
|
||||
set +e
|
||||
node scripts/verify-pages-public-data.mjs
|
||||
status=$?
|
||||
set -e
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "ready=true" >> "$GITHUB_OUTPUT"
|
||||
elif [ "$status" -eq 78 ]; then
|
||||
echo "ready=false" >> "$GITHUB_OUTPUT"
|
||||
echo "Public data is not due yet; skipping this scheduled deployment."
|
||||
else
|
||||
exit "$status"
|
||||
fi
|
||||
|
||||
- name: Build public site
|
||||
if: steps.publication.outputs.ready == 'true'
|
||||
run: npm run build:pages
|
||||
|
||||
- name: Publish generated files
|
||||
if: steps.publication.outputs.ready == 'true'
|
||||
env:
|
||||
GITHUB_PAGES_TOKEN: ${{ secrets.GITHUB_PAGES_TOKEN }}
|
||||
run: npm run publish:pages
|
||||
Reference in New Issue
Block a user