Publish docs via GitHub Pages workflow (developmentseed/lonboard)
The Publish docs via GitHub Pages workflow from developmentseed/lonboard, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Publish docs via GitHub Pages workflow from the developmentseed/lonboard 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: Publish docs via GitHub Pages
# Only run on new tags starting with `v`
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
build:
name: Deploy docs
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v3.2.0
id: app-token
with:
app-id: ${{ secrets.DS_RELEASE_BOT_ID }}
private-key: ${{ secrets.DS_RELEASE_BOT_PRIVATE_KEY }}
permission-contents: write
- uses: actions/checkout@v7
# We need to additionally fetch the gh-pages branch for mike deploy
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
- name: Install a specific version of uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
version: "0.4.x"
- name: Deploy docs
env:
GIT_COMMITTER_NAME: CI
GIT_COMMITTER_EMAIL: ci-bot@example.com
run: |
# Get most recent git tag
# https://stackoverflow.com/a/7261049
# We don't use {{github.ref_name}} because if triggered manually, it
# will be a branch name instead of a tag version.
VERSION=$(git describe --tags --abbrev=0)
# Only push docs if no letters in git tag after the first character
# (usually the git tag will have v as the first character)
if ! echo $VERSION | sed 's/^.//' | grep -q "[A-Za-z]"; then
uv run --group docs mike deploy $VERSION latest --update-aliases --push
fi
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Publish docs via GitHub Pages # Only run on new tags starting with `v` on: push: tags: - "v*" workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: timeout-minutes: 30 name: Deploy docs runs-on: latchkey-small steps: - uses: actions/create-github-app-token@v3.2.0 id: app-token with: app-id: ${{ secrets.DS_RELEASE_BOT_ID }} private-key: ${{ secrets.DS_RELEASE_BOT_PRIVATE_KEY }} permission-contents: write - uses: actions/checkout@v7 # We need to additionally fetch the gh-pages branch for mike deploy with: fetch-depth: 0 token: ${{ steps.app-token.outputs.token }} - name: Install a specific version of uv uses: astral-sh/setup-uv@v7 with: enable-cache: true version: "0.4.x" - name: Deploy docs env: GIT_COMMITTER_NAME: CI GIT_COMMITTER_EMAIL: ci-bot@example.com run: | # Get most recent git tag # https://stackoverflow.com/a/7261049 # We don't use {{github.ref_name}} because if triggered manually, it # will be a branch name instead of a tag version. VERSION=$(git describe --tags --abbrev=0) # Only push docs if no letters in git tag after the first character # (usually the git tag will have v as the first character) if ! echo $VERSION | sed 's/^.//' | grep -q "[A-Za-z]"; then uv run --group docs mike deploy $VERSION latest --update-aliases --push fi
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.
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.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.