Release Documentation workflow (sgl-project/SpecForge)
The Release Documentation workflow from sgl-project/SpecForge, explained and optimized by Latchkey.
CI health: B - good
Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Release Documentation workflow from the sgl-project/SpecForge repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Release Documentation
on:
push:
branches:
- main
paths:
- "docs/**"
- "version.txt"
workflow_dispatch:
concurrency:
group: release-docs-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy-github-pages:
runs-on: ubuntu-latest
if: github.repository == 'sgl-project/specforge' || github.repository == 'sleepcoo/SpecForge'
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: docs/spec_bundle/package-lock.json
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y pandoc parallel retry
pip install -r docs/requirements.txt
- name: Build spec bundle dashboard
run: |
# Copy logos to public directory
cp assets/logo.png docs/spec_bundle/public/logo.png
cp docs/_static/imgs/specbundle-logo.png docs/spec_bundle/public/specbundle-logo.png
cd docs/spec_bundle
npm ci
npm run build
# Clean up node_modules to prevent Sphinx from processing them
rm -rf node_modules
cd ..
- name: Build documentation
run: |
cd docs
make compile
make html
# Copy SpecBundle to root of output directory
mkdir -p _build/html/SpecBundle
cp -r spec_bundle/dist/* _build/html/SpecBundle/
- name: Add .nojekyll file
run: |
touch ./docs/_build/html/.nojekyll
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Release Documentation on: push: branches: - main paths: - "docs/**" - "version.txt" workflow_dispatch: concurrency: group: release-docs-${{ github.ref }} cancel-in-progress: true jobs: deploy-github-pages: timeout-minutes: 30 runs-on: latchkey-small if: github.repository == 'sgl-project/specforge' || github.repository == 'sleepcoo/SpecForge' permissions: contents: write steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v5 with: python-version: '3.13' - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' cache-dependency-path: docs/spec_bundle/package-lock.json - name: Install dependencies run: | sudo apt-get update && sudo apt-get install -y pandoc parallel retry pip install -r docs/requirements.txt - name: Build spec bundle dashboard run: | # Copy logos to public directory cp assets/logo.png docs/spec_bundle/public/logo.png cp docs/_static/imgs/specbundle-logo.png docs/spec_bundle/public/specbundle-logo.png cd docs/spec_bundle npm ci npm run build # Clean up node_modules to prevent Sphinx from processing them rm -rf node_modules cd .. - name: Build documentation run: | cd docs make compile make html # Copy SpecBundle to root of output directory mkdir -p _build/html/SpecBundle cp -r spec_bundle/dist/* _build/html/SpecBundle/ - name: Add .nojekyll file run: | touch ./docs/_build/html/.nojekyll - name: Deploy uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./docs/_build/html
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Add a job timeout so a hung step cannot burn hours of runner time.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.