publish docs workflow (urfave/cli)
The publish docs workflow from urfave/cli, explained and optimized by Latchkey.
C
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the publish docs workflow from the urfave/cli 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
workflow (.yml)
name: publish docs
on:
push:
branches:
- main
tags:
- v3.*
permissions:
contents: read
jobs:
test-docs:
name: test-docs
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: stable
- name: Set PATH
run: echo "${GITHUB_WORKSPACE}/.local/bin" >>"${GITHUB_PATH}"
- run: make ensure-gfmrun
- run: make gfmrun
env:
FLAGS: --walk docs/v3/
- run: make diffcheck
publish:
permissions:
contents: write
if: startswith(github.ref, 'refs/tags/')
name: publish
needs: [test-docs]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: '3.13'
cache: pip
cache-dependency-path: mkdocs-requirements.txt
- name: Ensure mkdocs is available
run: make ensure-mkdocs
- name: Set mkdocs remote
run: make set-mkdocs-remote
env:
MKDOCS_REMOTE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy via mkdocs
run: make deploy-mkdocs
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: publish docs on: push: branches: - main tags: - v3.* permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: test-docs: timeout-minutes: 30 name: test-docs runs-on: latchkey-small steps: - uses: actions/checkout@v7 - name: Set up Go uses: actions/setup-go@v6 with: go-version: stable - name: Set PATH run: echo "${GITHUB_WORKSPACE}/.local/bin" >>"${GITHUB_PATH}" - run: make ensure-gfmrun - run: make gfmrun env: FLAGS: --walk docs/v3/ - run: make diffcheck publish: timeout-minutes: 30 permissions: contents: write if: startswith(github.ref, 'refs/tags/') name: publish needs: [test-docs] runs-on: latchkey-small steps: - uses: actions/checkout@v7 with: fetch-depth: 0 - uses: actions/setup-python@v6 with: python-version: '3.13' cache: pip cache-dependency-path: mkdocs-requirements.txt - name: Ensure mkdocs is available run: make ensure-mkdocs - name: Set mkdocs remote run: make set-mkdocs-remote env: MKDOCS_REMOTE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Deploy via mkdocs run: make deploy-mkdocs
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.
- Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.