Skip to content

feat: begin repository stabilization (#377) #240

feat: begin repository stabilization (#377)

feat: begin repository stabilization (#377) #240

Workflow file for this run

name: Docs Deploy
# Build the documentation and deploy it to GitHub Pages. Triggers directly on
# push to main -- there is no longer a caller workflow multiplexing verify vs.
# deploy, so each half of that split (docs-ci.yml, this file) carries its own
# triggers and only the permissions it actually needs. Deploy is the only job
# that needs pages/id-token, which is why it stayed a separate file rather than
# folding into docs-ci.yml: a single workflow can never grant a job more
# permission than the workflow itself declares, so combining them would hand
# the gate and verify jobs credentials they have no use for.
"on":
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
packages: read
pages: write
id-token: write
concurrency:
group: github-pages
cancel-in-progress: false
defaults:
run:
shell: pwsh
jobs:
deploy:
name: Build and Deploy Documentation
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Run the build inside the published base image (template under /template
# with node_modules and PowerShell installed).
container:
image: ghcr.io/the-running-dev/docs-template:latest
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN || github.token }}
steps:
- name: Check out Repository
uses: actions/checkout@v7
with:
# Full history, not the default shallow clone -- the changelog step
# below reads the whole `git log`.
fetch-depth: 0
- name: Configure GitHub Pages
uses: actions/configure-pages@v6
# Regenerated fresh for every deploy, never committed -- replaces the old
# recurring "chore: update changelog" pull request. See the identical step
# in docs-ci.yml's verify job for the full rationale.
- name: Regenerate changelog (build-only, not committed)
run: |
# This job runs inside a container, so the checkout is owned by a
# different uid than the one running it -- git refuses to touch it
# ("dubious ownership") until explicitly trusted.
git config --global --add safe.directory "$env:GITHUB_WORKSPACE"
$body = & ./build/ConvertTo-Changelog.ps1 -RepoRoot . -RepositorySlug '${{ github.repository }}'
$docsPage = @('---', 'slug: changelog', '---', '') + $body
Set-Content -Path 'docs/docs/engine/CHANGELOG.md' -Value $docsPage -Encoding utf8NoBOM
- name: Build Documentation
run: /template/scripts/docs-build.ps1 -SourceDocs ./docs -OutputPath artifacts/docs
# The landing page is a second, independent project (site/) sharing
# this one GitHub Pages deployment: it serves "/", the docs serve
# "/docs". The base image already has Node -- no setup-node needed.
#
# `check`, not a bare build -- see docs-ci.yml's verify job, which
# runs the same command. This job is the one that actually runs on
# a push to main (verify skips push events), so it is also the
# last thing standing between a broken landing page and a real
# deploy if a check was ever bypassed getting there.
- name: Cache Alpine Chromium packages
uses: actions/cache@v4
with:
path: /tmp/apk-cache
key: alpine-chromium-${{ runner.arch }}-v1
# The real-browser suite needs Chromium installed first -- it is
# not part of the base image, unlike Node. `playwright install
# --with-deps` shells out to apt-get, but this container
# (docs-template) is Alpine, so that step just fails outright
# ("apt-get: not found"). Install Alpine's own `chromium` package
# instead and point vitest.browser.config.ts at it via
# PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH -- identical to docs-ci.yml's
# verify job; that copy proved the fix before it landed here.
- name: Build and verify landing page
env:
PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH: /usr/bin/chromium-browser
run: |
mkdir -p /tmp/apk-cache
apk add --cache-dir /tmp/apk-cache chromium
npm --prefix src/engine ci
npm --prefix src/engine run build
npm --prefix site ci
npm --prefix site run check
# Overlays the landing page onto the docs build -- the package-backed
# `merge` command (subzerodev-platform-ui-landing-page@0.2.0), invoked
# via the same site/package.json script docs-ci.yml's verify job runs
# and proves on every PR before this ever runs here on push to main.
- name: Merge landing page into documentation build
run: npm --prefix site run merge
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v5
with:
path: artifacts/docs
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5