Dev docs workflow (ultimate-notion/ultimate-notion)
The Dev docs workflow from ultimate-notion/ultimate-notion, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get caching, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Dev docs workflow from the ultimate-notion/ultimate-notion 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: Dev docs
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: dev-docs-deploy
cancel-in-progress: true
env:
FORCE_COLOR: "1"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
# Fetch all history for applying timestamps to every page
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Setup environment requirements
uses: ./.github/actions/setup-venv-reqs
- name: Configure Git for GitHub Actions bot
run: |
git config --local user.name 'github-actions[bot]'
git config --local user.email 'github-actions[bot]@users.noreply.github.com'
- name: Build documentation
run: hatch run docs:build-check
- name: Commit documentation on gh-pages
run: hatch run docs:ci-build dev
- name: Create archive
run: git archive -o site.zip gh-pages
- uses: actions/upload-artifact@v7
with:
name: docs
path: site.zip
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download archive
uses: actions/download-artifact@v8
with:
name: docs
- name: Unpack archive
run: python -m zipfile -e site.zip site
- name: Deploy to GitHub Pages
id: deployment
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: site
commit_message: ${{ github.event.head_commit.message }}
# Write .nojekyll at the root, see:
# https://help.github.com/en/github/working-with-github-pages/about-github-pages#static-site-generators
enable_jekyll: false
# Only deploy if there were changes
allow_empty_commit: false
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: Dev docs on: push: branches: - main workflow_dispatch: concurrency: group: dev-docs-deploy cancel-in-progress: true env: FORCE_COLOR: "1" jobs: build: timeout-minutes: 30 runs-on: latchkey-small steps: - uses: actions/checkout@v6 with: # Fetch all history for applying timestamps to every page fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v6 with: cache: 'pip' python-version: '3.10' - name: Setup environment requirements uses: ./.github/actions/setup-venv-reqs - name: Configure Git for GitHub Actions bot run: | git config --local user.name 'github-actions[bot]' git config --local user.email 'github-actions[bot]@users.noreply.github.com' - name: Build documentation run: hatch run docs:build-check - name: Commit documentation on gh-pages run: hatch run docs:ci-build dev - name: Create archive run: git archive -o site.zip gh-pages - uses: actions/upload-artifact@v7 with: name: docs path: site.zip deploy: timeout-minutes: 30 environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: latchkey-small needs: - build steps: - name: Download archive uses: actions/download-artifact@v8 with: name: docs - name: Unpack archive run: python -m zipfile -e site.zip site - name: Deploy to GitHub Pages id: deployment uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: site commit_message: ${{ github.event.head_commit.message }} # Write .nojekyll at the root, see: # https://help.github.com/en/github/working-with-github-pages/about-github-pages#static-site-generators enable_jekyll: false # Only deploy if there were changes allow_empty_commit: false
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.
- 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 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.