Backstop Publish workflow (garris/BackstopJS)
The Backstop Publish workflow from garris/BackstopJS, 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 Backstop Publish workflow from the garris/BackstopJS 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: Backstop Publish
#doesnt work :(
on:
workflow_dispatch:
workflow_call:
permissions:
actions: write
checks: write
contents: write
pull-requests: write
packages: write
env:
BRANCH_NAME: ${{ github.event.pull_request.head.sha || github.head_ref || github.ref_name }}
NODE_VERSION: 20
jobs:
backstop-publish-flow:
name: publish-flow
runs-on: ubuntu-latest
steps:
- name: publish to npm
uses: ./.github/workflows/npm-push.yml
- name: publish to dockerhub
uses: ./.github/workflows/dockerhub-build-push.yml
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Backstop Publish #doesnt work :( on: workflow_dispatch: workflow_call: permissions: actions: write checks: write contents: write pull-requests: write packages: write env: BRANCH_NAME: ${{ github.event.pull_request.head.sha || github.head_ref || github.ref_name }} NODE_VERSION: 20 jobs: backstop-publish-flow: timeout-minutes: 30 name: publish-flow runs-on: latchkey-small steps: - name: publish to npm uses: ./.github/workflows/npm-push.yml - name: publish to dockerhub uses: ./.github/workflows/dockerhub-build-push.yml
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 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.