Docs Versioning workflow (Farama-Foundation/Gymnasium-Robotics)
The Docs Versioning workflow from Farama-Foundation/Gymnasium-Robotics, explained and optimized by Latchkey.
CI health: D - needs work
Point runs-on at Latchkey and get caching, run de-duplication, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the 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: Docs Versioning
on:
push:
tags:
- 'v?*.*.*'
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
- uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
- 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: ${{steps.tag.outputs.tag}}
clean: false
- name: Upload to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
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: Docs Versioning on: push: tags: - 'v?*.*.*' permissions: contents: write concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true 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 - uses: actions/setup-python@v6 with: cache: 'pip' python-version: '3.10' - name: Get tag id: tag uses: dawidd6/action-get-tag@v1 - 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: ${{steps.tag.outputs.tag}} clean: false - name: Upload to GitHub Pages uses: JamesIves/github-pages-deploy-action@v4 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. - Cancel superseded runs when a branch or PR gets a newer push.
- Cache dependency installs on the setup step so they are served from cache.
2 third-party actions are referenced by a movable tag. Pin them 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.