name: Deploy Site on: push: branches: [main] paths: - "platforms/**" - "emulators/**" - "provenance/**" - "wiki/**" - "exports/**" # Every script the build runs or imports, and no other # (tests/test_workflow_paths.py). - "scripts/acquire/provenance.py" - "scripts/core/__init__.py" - "scripts/core/anchors.py" - "scripts/core/artifacts.py" - "scripts/core/cli.py" - "scripts/core/crypto_verify.py" - "scripts/core/github.py" - "scripts/core/hashing.py" - "scripts/core/options.py" - "scripts/core/paths.py" - "scripts/core/romdir.py" - "scripts/core/sect233r1.py" - "scripts/core/sizes.py" - "scripts/core/upstream.py" - "scripts/core/ziptools.py" - "scripts/devtools/__init__.py" - "scripts/devtools/prchecks.py" - "scripts/generate_readme.py" - "scripts/generate_site.py" - "scripts/indexnow.py" - "scripts/installer_build/__init__.py" - "scripts/installer_build/eventschema.py" - "scripts/installer_build/handhelds.py" - "scripts/installer_build/pins.py" - "scripts/installer_build/port.py" - "scripts/model/__init__.py" - "scripts/model/alternatives.py" - "scripts/model/cliargs.py" - "scripts/model/collection.py" - "scripts/model/composition.py" - "scripts/model/database.py" - "scripts/model/declarations.py" - "scripts/model/dumpcatalog.py" - "scripts/model/guides.py" - "scripts/model/largefiles.py" - "scripts/model/measurements.py" - "scripts/model/nodedup.py" - "scripts/model/platforms.py" - "scripts/model/profiles.py" - "scripts/model/region.py" - "scripts/model/registry.py" - "scripts/model/releaserecord.py" - "scripts/model/retired.py" - "scripts/model/safeparse.py" - "scripts/model/siteinputs.py" - "scripts/model/sourceref.py" - "scripts/model/sources.py" - "scripts/model/systemnames.py" - "scripts/model/systems.py" - "scripts/model/targets.py" - "scripts/packs/__init__.py" - "scripts/packs/archive.py" - "scripts/packs/coverage.py" - "scripts/packs/crossref.py" - "scripts/packs/datadirs.py" - "scripts/packs/extras.py" - "scripts/packs/gaps.py" - "scripts/packs/naming.py" - "scripts/packs/parts.py" - "scripts/packs/paths.py" - "scripts/packs/slots.py" - "scripts/packs/verdicts.py" - "scripts/refresh_data_dirs.py" - "scripts/release/restore.py" - "scripts/resolve/__init__.py" - "scripts/resolve/archives.py" - "scripts/resolve/categories.py" - "scripts/resolve/collisions.py" - "scripts/resolve/content.py" - "scripts/resolve/contentlayout.py" - "scripts/resolve/cores.py" - "scripts/resolve/datadirs.py" - "scripts/resolve/directories.py" - "scripts/resolve/gamedata.py" - "scripts/resolve/grouping.py" - "scripts/resolve/launcherrefs.py" - "scripts/resolve/launchers.py" - "scripts/resolve/layout.py" - "scripts/resolve/localfile.py" - "scripts/resolve/nativemode.py" - "scripts/resolve/ownership.py" - "scripts/resolve/packfiles.py" - "scripts/resolve/reconcile.py" - "scripts/resolve/regions.py" - "scripts/resolve/review.py" - "scripts/resolve/slot.py" - "scripts/resolve/standalone.py" - "scripts/resolve/truth.py" - "scripts/resolve/validation.py" - "scripts/restore_large_files.py" - "scripts/romrecipes/__init__.py" - "scripts/romrecipes/ledger.py" - "scripts/site_markdown.py" - "scripts/sitegen/__init__.py" - "scripts/sitegen/agents.py" - "scripts/sitegen/apiitems.py" - "scripts/sitegen/bootstrap.py" - "scripts/sitegen/build.py" - "scripts/sitegen/cards.py" - "scripts/sitegen/config.py" - "scripts/sitegen/consolecards.py" - "scripts/sitegen/crossref.py" - "scripts/sitegen/dataexports.py" - "scripts/sitegen/datapage.py" - "scripts/sitegen/decorate.py" - "scripts/sitegen/descriptions.py" - "scripts/sitegen/diagrams.py" - "scripts/sitegen/emulatorcards.py" - "scripts/sitegen/emulatorpage.py" - "scripts/sitegen/emulatorsindex.py" - "scripts/sitegen/entries.py" - "scripts/sitegen/exports.py" - "scripts/sitegen/fields.py" - "scripts/sitegen/gaps.py" - "scripts/sitegen/getpages.py" - "scripts/sitegen/guidepage.py" - "scripts/sitegen/guides.py" - "scripts/sitegen/handheld.py" - "scripts/sitegen/home.py" - "scripts/sitegen/install.py" - "scripts/sitegen/lookup.py" - "scripts/sitegen/markup.py" - "scripts/sitegen/measurements.py" - "scripts/sitegen/nav.py" - "scripts/sitegen/pagemarkdown.py" - "scripts/sitegen/parts.py" - "scripts/sitegen/places.py" - "scripts/sitegen/platformfiles.py" - "scripts/sitegen/platformindex.py" - "scripts/sitegen/platformpage.py" - "scripts/sitegen/provenance.py" - "scripts/sitegen/publish.py" - "scripts/sitegen/readme.py" - "scripts/sitegen/reference.py" - "scripts/sitegen/render.py" - "scripts/sitegen/sources.py" - "scripts/sitegen/starlight.py" - "scripts/sitegen/startwith.py" - "scripts/sitegen/steps.py" - "scripts/sitegen/structured.py" - "scripts/sitegen/systempages.py" - "scripts/sitegen/systemsindex.py" - "scripts/sitegen/validate.py" - "scripts/sitegen/versions.py" - "scripts/sitegen/wanted.py" - "scripts/sitegen/whichpack.py" - "scripts/sitegen/write.py" - "scripts/validate_schemas.py" - "scripts/validate_site.py" - "schemas/**" - "docs_assets/**" - "install/**" # The site serves install.sh and install.ps1 pinned to install.py # of the commit it is built from (scripts/sitebootstrap.py). - "install.py" - "installer/**" - "install.sh" - "install.ps1" # The handheld launchers it serves are built from ports/ at the same # commit (scripts/sitehandheld.py). - "ports/**" - "database.json" - "release.json" - "derivable.json" - "retired.json" # The README and the archive recipes page count the recipes. - "recipes/archives.json" - "measurements/**" # The Proof lines of the emulator pages read what an issue's runs showed. - "tests/campaign/observations.yml" # The Starlight project: config, components, styles, lockfile. Its # generated folders are gitignored and never trigger anything. - "website/**" - ".github/workflows/deploy-site.yml" # The contributing guide quotes the pip lines of its test job. - ".github/workflows/validate.yml" workflow_dispatch: permissions: contents: read pages: write id-token: write concurrency: # Pages deployments must run to completion: cancelling one mid-flight # leaves the deployment stuck and makes the next runs time out waiting # on it. Queued runs collapse to the latest instead. group: pages cancel-in-progress: false jobs: build: runs-on: ubuntu-latest outputs: indexnow: ${{ steps.indexnow.outputs.payload }} # Node's compile cache writes under /tmp on every node run, the build # and the search gate alike. env: NODE_DISABLE_COMPILE_CACHE: "1" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 with: python-version: "3.12" - run: pip install pyyaml "jsonschema[format-nongpl]==4.26.0" # Node builds the site only: the scripts stay Python. The engine and # its plugins are pinned exactly in website/package.json and resolved # from the committed lockfile. - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: "24" cache: npm cache-dependency-path: website/package-lock.json - run: npm ci --prefix website - name: Validate data contracts run: python scripts/validate_schemas.py # Coverage is resolved against the disk, so a checkout without the # release assets and the data caches reports files as missing and the # generated README stops matching the committed one. - name: Restore large files from release run: | mkdir -p .cache/large gh release download large-files -D .cache/large/ 2>/dev/null || true python scripts/restore_large_files.py env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Refresh data directories run: python scripts/refresh_data_dirs.py - name: Generate site run: | python scripts/generate_site.py python scripts/generate_readme.py --db database.json --platforms-dir platforms # starlight-links-validator fails the build on a dead link or anchor. npm run build --prefix website python scripts/validate_site.py --site-dir website/dist # The one-liner the site serves: each copy pins its own installer and # says what a refusal means for it. Validation runs these too, but in # another workflow this one never waits for: a copy that refuses every # install must stop the deploy, the last good pair staying served. - name: Check the served bootstraps run: python -m unittest tests.test_site_bootstrap # The queries a visitor types must reach the page that answers them, # read through the site's own search box, and the home page must stay # under its weight budget. A miss blocks the deploy. The browser driver # is not a dependency of the build: pinned here, not saved to the # lockfile, and it drives the Chrome the runner image ships. - name: Search gate run: | npm install --no-save --prefix website playwright-core@1.58.0 python website/tools/search_gate.py --site-dir website/dist # write_if_changed() compares content with its timestamp line stripped, # so a run that only moves the clock leaves the file untouched and this # stays a real staleness check rather than a guaranteed failure. - name: Require committed README and CONTRIBUTING to be current run: git diff --exit-code -- README.md CONTRIBUTING.md # The pages whose words this deploy changes, read against the # digests the live site still serves. A failure here only loses the # notice: search engines find the pages on their next visit. - name: List the pages this deploy changes id: indexnow continue-on-error: true run: python scripts/indexnow.py --dist website/dist --output "$GITHUB_OUTPUT" - name: Setup Pages uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6 - name: Upload artifact uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5 with: path: website/dist/ deploy: needs: build runs-on: ubuntu-latest environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 # IndexNow: Bing, Yandex, Seznam and Naver fetch the listed pages # soon after, so an assistant searching through them reads this build. - name: Tell search engines which pages changed if: needs.build.outputs.indexnow != '' continue-on-error: true env: PAYLOAD: ${{ needs.build.outputs.indexnow }} run: | code=$(curl -sS -o /dev/null -w '%{http_code}' -X POST \ -H 'Content-Type: application/json; charset=utf-8' \ --data "$PAYLOAD" https://api.indexnow.org/indexnow) echo "IndexNow answered $code" case "$code" in 200|202) ;; *) echo "::warning::IndexNow answered $code"; exit 1 ;; esac