Build Releases workflow (nkanaev/yarr)
The Build Releases workflow from nkanaev/yarr, 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 Build Releases workflow from the nkanaev/yarr 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: Build Releases
on: workflow_call
jobs:
build_macos:
name: Build for MacOS
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Setup Node
uses: actions/setup-node@v6
- name: Install dependencies
run: npm ci
- name: Build arm64 gui
uses: ./.github/actions/prepare
with:
id: darwin_arm64_gui
cmd: make darwin_arm64_gui
out: out/darwin_arm64_gui/yarr.app
- name: Build amd64 gui
uses: ./.github/actions/prepare
with:
id: darwin_amd64_gui
cmd: make darwin_amd64_gui
out: out/darwin_amd64_gui/yarr.app
- name: Build arm64 cli
uses: ./.github/actions/prepare
with:
id: darwin_arm64
cmd: make darwin_arm64
out: out/darwin_arm64/yarr
- name: Build amd64 cli
uses: ./.github/actions/prepare
with:
id: darwin_amd64
cmd: make darwin_amd64
out: out/darwin_amd64/yarr
build_windows:
name: Build for Windows
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Setup Node
uses: actions/setup-node@v6
- name: Install dependencies
run: npm ci
- name: Build amd64 gui
uses: ./.github/actions/prepare
with:
id: windows_amd64_gui
cmd: make windows_amd64_gui
out: out/windows_amd64_gui/yarr.exe
- name: Build arm64 gui
if: false
uses: ./.github/actions/prepare
with:
id: windows_arm64_gui
cmd: make windows_arm64_gui
out: out/windows_arm64_gui/yarr.exe
build_multi_cli:
name: Build for Windows/Linux (CLI)
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Setup Node
uses: actions/setup-node@v6
- name: Install dependencies
run: npm ci
- name: Setup Zig
uses: mlugg/setup-zig@v1
with:
version: 0.14.0
- name: Build linux/amd64
uses: ./.github/actions/prepare
with:
id: linux_amd64
cmd: make linux_amd64
out: out/linux_amd64/yarr
- name: Build linux/arm64
uses: ./.github/actions/prepare
with:
id: linux_arm64
cmd: make linux_arm64
out: out/linux_arm64/yarr
- name: Build linux/armv7
uses: ./.github/actions/prepare
with:
id: linux_armv7
cmd: make linux_armv7
out: out/linux_armv7/yarr
- name: Build windows/amd64
uses: ./.github/actions/prepare
with:
id: windows_amd64
cmd: make windows_amd64
out: out/windows_amd64/yarr
- name: Build windows/arm64
uses: ./.github/actions/prepare
with:
id: windows_arm64
cmd: make windows_arm64
out: out/windows_arm64/yarr
create_release:
name: Create Release
runs-on: ubuntu-latest
needs: [build_macos, build_windows, build_multi_cli]
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4.1.7
with:
path: .
- name: Preparation
run: |
set -ex
ls -R
for tarfile in `ls **/*.tar`; do
tar -xvf $tarfile
done
for dir in out/*; do
echo "Compressing: $dir"
(test -d "$dir" && cd $dir && zip -r ../yarr_`basename $dir`.zip *)
done
ls out
- name: Upload Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
prerelease: true
files: |
out/*.zip
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: Build Releases on: workflow_call jobs: build_macos: timeout-minutes: 30 name: Build for MacOS runs-on: macos-latest steps: - name: Checkout uses: actions/checkout@v6 - name: Setup Go uses: actions/setup-go@v6 with: go-version-file: 'go.mod' - name: Setup Node uses: actions/setup-node@v6 with: cache: 'npm' - name: Install dependencies run: npm ci - name: Build arm64 gui uses: ./.github/actions/prepare with: id: darwin_arm64_gui cmd: make darwin_arm64_gui out: out/darwin_arm64_gui/yarr.app - name: Build amd64 gui uses: ./.github/actions/prepare with: id: darwin_amd64_gui cmd: make darwin_amd64_gui out: out/darwin_amd64_gui/yarr.app - name: Build arm64 cli uses: ./.github/actions/prepare with: id: darwin_arm64 cmd: make darwin_arm64 out: out/darwin_arm64/yarr - name: Build amd64 cli uses: ./.github/actions/prepare with: id: darwin_amd64 cmd: make darwin_amd64 out: out/darwin_amd64/yarr build_windows: timeout-minutes: 30 name: Build for Windows runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v6 - name: Setup Go uses: actions/setup-go@v6 with: go-version-file: 'go.mod' - name: Setup Node uses: actions/setup-node@v6 with: cache: 'npm' - name: Install dependencies run: npm ci - name: Build amd64 gui uses: ./.github/actions/prepare with: id: windows_amd64_gui cmd: make windows_amd64_gui out: out/windows_amd64_gui/yarr.exe - name: Build arm64 gui if: false uses: ./.github/actions/prepare with: id: windows_arm64_gui cmd: make windows_arm64_gui out: out/windows_arm64_gui/yarr.exe build_multi_cli: timeout-minutes: 30 name: Build for Windows/Linux (CLI) runs-on: latchkey-small steps: - name: Checkout uses: actions/checkout@v6 - name: Setup Go uses: actions/setup-go@v6 with: go-version-file: 'go.mod' - name: Setup Node uses: actions/setup-node@v6 with: cache: 'npm' - name: Install dependencies run: npm ci - name: Setup Zig uses: mlugg/setup-zig@v1 with: version: 0.14.0 - name: Build linux/amd64 uses: ./.github/actions/prepare with: id: linux_amd64 cmd: make linux_amd64 out: out/linux_amd64/yarr - name: Build linux/arm64 uses: ./.github/actions/prepare with: id: linux_arm64 cmd: make linux_arm64 out: out/linux_arm64/yarr - name: Build linux/armv7 uses: ./.github/actions/prepare with: id: linux_armv7 cmd: make linux_armv7 out: out/linux_armv7/yarr - name: Build windows/amd64 uses: ./.github/actions/prepare with: id: windows_amd64 cmd: make windows_amd64 out: out/windows_amd64/yarr - name: Build windows/arm64 uses: ./.github/actions/prepare with: id: windows_arm64 cmd: make windows_arm64 out: out/windows_arm64/yarr create_release: timeout-minutes: 30 name: Create Release runs-on: latchkey-small needs: [build_macos, build_windows, build_multi_cli] steps: - name: Download Artifacts uses: actions/download-artifact@v4.1.7 with: path: . - name: Preparation run: | set -ex ls -R for tarfile in `ls **/*.tar`; do tar -xvf $tarfile done for dir in out/*; do echo "Compressing: $dir" (test -d "$dir" && cd $dir && zip -r ../yarr_`basename $dir`.zip *) done ls out - name: Upload Release uses: softprops/action-gh-release@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: draft: true prerelease: true files: | out/*.zip
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.
2 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 4 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.