Files
dal4segno f5d9bef547
Publish GitHub Pages output / publish (push) Successful in 41s
feat: add consent-based GA4 analytics
2026-08-31 14:42:59 +09:00

58 lines
1.4 KiB
YAML

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'
env:
VITE_GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }}
run: npm run build:pages
- name: Publish generated files
if: steps.publication.outputs.ready == 'true'
env:
GITHUB_PAGES_TOKEN: ${{ secrets.PAGES_GITHUB_TOKEN }}
run: npm run publish:pages