Manual Docs Versioning workflow (Farama-Foundation/Gymnasium-Robotics)
The Manual Docs Versioning workflow from Farama-Foundation/Gymnasium-Robotics, explained and optimized by Latchkey.
CI health: B - good
Point runs-on at Latchkey and get caching, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Manual Docs Versioning workflow from the Farama-Foundation/Gymnasium-Robotics 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: Manual Docs Versioning
on:
workflow_dispatch:
inputs:
version:
description: 'Documentation version to create'
required: true
commit:
description: 'Commit used to build the Documentation version'
required: false
latest:
description: 'Latest version'
type: boolean
permissions:
contents: write
jobs:
docs:
name: Generate Website for new version
runs-on: ubuntu-latest
env:
SPHINX_GITHUB_CHANGELOG_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v7
if: inputs.commit == ''
- uses: actions/checkout@v7
if: inputs.commit != ''
with:
ref: ${{ inputs.commit }}
- uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install docs requirements
run: pip install -r docs/requirements.txt
- name: Install requirements and Gymnasium-Robotics
run: pip install -e .
- name: Build Envs Docs
run: python docs/_scripts/gen_mds.py
- name: Build Envs Displays
run: python docs/_scripts/gen_envs_display.py
- name: Build
run: sphinx-build -b dirhtml -v docs _build
- name: Move 404
run: mv _build/404/index.html _build/404.html
- name: Update 404 links
run: python docs/_scripts/move_404.py _build/404.html
- name: Remove .doctrees
run: rm -r _build/.doctrees
- name: Upload to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: _build
target-folder: ${{ inputs.version }}
clean: false
- name: Upload to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
if: inputs.latest
with:
folder: _build
clean-exclude: |
*.*.*/
main
The same workflow, on Latchkey
Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.
name: Manual Docs Versioning on: workflow_dispatch: inputs: version: description: 'Documentation version to create' required: true commit: description: 'Commit used to build the Documentation version' required: false latest: description: 'Latest version' type: boolean permissions: contents: write jobs: docs: name: Generate Website for new version runs-on: latchkey-small env: SPHINX_GITHUB_CHANGELOG_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v7 if: inputs.commit == '' - uses: actions/checkout@v7 if: inputs.commit != '' with: ref: ${{ inputs.commit }} - uses: actions/setup-python@v6 with: cache: 'pip' python-version: '3.10' - name: Install docs requirements run: pip install -r docs/requirements.txt - name: Install requirements and Gymnasium-Robotics run: pip install -e . - name: Build Envs Docs run: python docs/_scripts/gen_mds.py - name: Build Envs Displays run: python docs/_scripts/gen_envs_display.py - name: Build run: sphinx-build -b dirhtml -v docs _build - name: Move 404 run: mv _build/404/index.html _build/404.html - name: Update 404 links run: python docs/_scripts/move_404.py _build/404.html - name: Remove .doctrees run: rm -r _build/.doctrees - name: Upload to GitHub Pages uses: JamesIves/github-pages-deploy-action@v4 with: folder: _build target-folder: ${{ inputs.version }} clean: false - name: Upload to GitHub Pages uses: JamesIves/github-pages-deploy-action@v4 if: inputs.latest with: folder: _build clean-exclude: | *.*.*/ main
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. - Cache dependency installs on the setup step so they are served from cache.
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.