A cartoon browser game about building the internet, deployed to https://seriesoftub.es from published releases only. - site/: the single-file game plus favicons, app icons, manifest, social image, robots.txt, sitemap.xml, llms.txt and a 404 page. - Full SEO head: canonical URL, Open Graph and Twitter cards, WebSite and VideoGame structured data, noscript fallback. - Cookieless Ridiculytics analytics via stats.seriesoftub.es, pinned with SRI and active only on the production domain. - Headless test suite (node:test + jsdom), CI on every push, and a release workflow that verifies the tag, tests, builds, deploys to GitHub Pages and pings IndexNow.
87 lines
2.8 KiB
YAML
87 lines
2.8 KiB
YAML
name: Release to GitHub Pages
|
|
|
|
# The live site at https://seriesoftub.es only ever serves a published release.
|
|
# Pushes to main run CI but never deploy. To ship: bump "version" in
|
|
# package.json, add a CHANGELOG entry, merge, then publish a GitHub release
|
|
# tagged v<version>.
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: Existing release tag to redeploy (e.g. v1.0.0)
|
|
required: true
|
|
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
concurrency:
|
|
group: pages
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
build:
|
|
# Pre-releases are for testing and never go live.
|
|
if: ${{ github.event_name == 'workflow_dispatch' || !github.event.release.prerelease }}
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
TAG: ${{ github.event.release.tag_name || inputs.tag }}
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
ref: ${{ env.TAG }}
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 24
|
|
cache: npm
|
|
- name: Tag must match package.json version
|
|
run: |
|
|
set -euo pipefail
|
|
want="v$(node -p "require('./package.json').version")"
|
|
if [ "$TAG" != "$want" ]; then
|
|
echo "::error::Release tag $TAG does not match package.json version ($want)"
|
|
exit 1
|
|
fi
|
|
- run: npm ci
|
|
- run: npm test
|
|
- name: Build site
|
|
run: VERSION="${TAG#v}" npm run build
|
|
- uses: actions/upload-pages-artifact@v5
|
|
with:
|
|
path: ./_site
|
|
|
|
deploy:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
steps:
|
|
- id: deployment
|
|
uses: actions/deploy-pages@v5
|
|
|
|
# Tell IndexNow (Bing, Yandex, Seznam, …) about the new version, only after
|
|
# the site is live.
|
|
indexnow:
|
|
needs: deploy
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
# IndexNow keys are public by design (also served at /<key>.txt).
|
|
HOST: seriesoftub.es
|
|
KEY: d000727792a2ac2fdaa24ec953ed6d2b
|
|
steps:
|
|
- name: Submit sitemap URLs to IndexNow
|
|
run: |
|
|
set -euo pipefail
|
|
urls=$(curl -sSf "https://$HOST/sitemap.xml" | grep -oP '(?<=<loc>)[^<]+' | grep -v '\.png$' | jq -R . | jq -s .)
|
|
payload=$(jq -n --arg host "$HOST" --arg key "$KEY" \
|
|
--arg keyLocation "https://$HOST/$KEY.txt" --argjson urlList "$urls" \
|
|
'{host: $host, key: $key, keyLocation: $keyLocation, urlList: $urlList}')
|
|
code=$(curl -sS -X POST "https://api.indexnow.org/indexnow" \
|
|
-H "Content-Type: application/json; charset=utf-8" --data "$payload" \
|
|
-o /tmp/indexnow.txt -w '%{http_code}')
|
|
echo "IndexNow responded HTTP $code"; cat /tmp/indexnow.txt || true
|
|
if [ "$code" -ge 400 ]; then echo "::warning::IndexNow submission failed ($code)"; fi
|