Build & Deploy docs site workflow (ISS-Mimic/Mimic)
The Build & Deploy docs site workflow from ISS-Mimic/Mimic, 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 Build & Deploy docs site workflow from the ISS-Mimic/Mimic 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)
# .github/workflows/pages.yml
name: Build & Deploy docs site
on:
push:
branches: [main] # branch that contains docs/
paths:
- "docs/**" # only rebuild when anything under docs/ changes
- ".github/workflows/pages.yml" # allow yourself to tweak the workflow
# optional: handle PR previews
# pull_request:
# paths: ["docs/**"]
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v5
# If you have a static-site generator, build it here…
- uses: actions/upload-pages-artifact@v3
with:
path: docs # directory to publish
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
- id: deployment
uses: actions/deploy-pages@v4
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
# .github/workflows/pages.yml name: Build & Deploy docs site on: push: branches: [main] # branch that contains docs/ paths: - "docs/**" # only rebuild when anything under docs/ changes - ".github/workflows/pages.yml" # allow yourself to tweak the workflow # optional: handle PR previews # pull_request: # paths: ["docs/**"] permissions: contents: read pages: write id-token: write concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: timeout-minutes: 30 runs-on: latchkey-small steps: - uses: actions/checkout@v4 - uses: actions/configure-pages@v5 # If you have a static-site generator, build it here… - uses: actions/upload-pages-artifact@v3 with: path: docs # directory to publish deploy: timeout-minutes: 30 needs: build runs-on: latchkey-small environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} permissions: pages: write id-token: write steps: - id: deployment uses: actions/deploy-pages@v4
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.