Publish docs workflow (nhn/tui.image-editor)
The Publish docs workflow from nhn/tui.image-editor, explained and optimized by Latchkey.
A
CI health: A - excellent
Point runs-on at Latchkey and get 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 nhn/tui.image-editor 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: [workflow_dispatch]
env:
BUILD_CACHE_KEY: ${{ github.sha }}
jobs:
install-dependencies:
name: Install dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v2
- name: Install dependencies
id: cache-keys
uses: ./.github/composite-actions/install-dependencies
outputs:
root_cache_key: ${{ steps.cache-keys.outputs.root_cache_key }}
build:
name: Build package using cache
needs: [install-dependencies]
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v2
with:
ref: production
- name: build
uses: ./.github/composite-actions/build-package
with:
ROOT_CACHE_KEY: ${{ needs.install-dependencies.outputs.root_cache_key }}
BUILD_CACHE_KEY: ${{ env.BUILD_CACHE_KEY }}
outputs:
root_cache_key: ${{ needs.install-dependencies.outputs.root_cache_key }}
publish-docs:
needs: [build]
name: Publish docs
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v2
with:
ref: production
- name: Publish docs
uses: ./.github/composite-actions/publish-docs
with:
ROOT_CACHE_KEY: ${{ needs.build.outputs.root_cache_key }}
BUILD_CACHE_KEY: ${{ env.BUILD_CACHE_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Publish docs on: [workflow_dispatch] env: BUILD_CACHE_KEY: ${{ github.sha }} jobs: install-dependencies: timeout-minutes: 30 name: Install dependencies runs-on: latchkey-small steps: - name: Checkout branch uses: actions/checkout@v2 - name: Install dependencies id: cache-keys uses: ./.github/composite-actions/install-dependencies outputs: root_cache_key: ${{ steps.cache-keys.outputs.root_cache_key }} build: timeout-minutes: 30 name: Build package using cache needs: [install-dependencies] runs-on: latchkey-small steps: - name: Checkout branch uses: actions/checkout@v2 with: ref: production - name: build uses: ./.github/composite-actions/build-package with: ROOT_CACHE_KEY: ${{ needs.install-dependencies.outputs.root_cache_key }} BUILD_CACHE_KEY: ${{ env.BUILD_CACHE_KEY }} outputs: root_cache_key: ${{ needs.install-dependencies.outputs.root_cache_key }} publish-docs: timeout-minutes: 30 needs: [build] name: Publish docs runs-on: latchkey-small steps: - name: Checkout branch uses: actions/checkout@v2 with: ref: production - name: Publish docs uses: ./.github/composite-actions/publish-docs with: ROOT_CACHE_KEY: ${{ needs.build.outputs.root_cache_key }} BUILD_CACHE_KEY: ${{ env.BUILD_CACHE_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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. - Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 3 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.