Release Offline Bundles workflow (noho/dayu-agent)
The Release Offline Bundles workflow from noho/dayu-agent, explained and optimized by Latchkey.
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 Release Offline Bundles workflow from the noho/dayu-agent repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Release Offline Bundles
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: write
jobs:
build-wheel:
name: build-wheel (py3.11)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install build frontend
run: python -m pip install --upgrade pip build
- name: Build wheel
run: python -m build --wheel
- name: Resolve wheel path
shell: bash
run: |
WHEEL_PATH="$(python - <<'PY'
from pathlib import Path
wheels = sorted(Path("dist").glob("dayu_agent-*.whl"))
if len(wheels) != 1:
raise SystemExit(f"unexpected wheels: {wheels}")
print(wheels[0])
PY
)"
echo "WHEEL_PATH=$WHEEL_PATH" >> "$GITHUB_ENV"
- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: dayu-wheel
path: ${{ env.WHEEL_PATH }}
- name: Upload wheel release asset
if: github.event_name == 'release'
# v2
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65
with:
files: ${{ env.WHEEL_PATH }}
build-offline-windows-x64:
name: build-offline windows-x64 (py3.11)
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install locked dependencies
uses: ./.github/actions/install-locked-env
with:
constraints-path: constraints/lock-windows-x64-py311.txt
- name: Build and smoke test offline bundle
id: build_offline_bundle
uses: ./.github/actions/build-and-smoke-offline-bundle
with:
constraints-path: constraints/lock-windows-x64-py311.txt
platform-id: windows-x64
- name: Upload workflow artifact
uses: actions/upload-artifact@v4
with:
name: offline-windows-x64
path: ${{ steps.build_offline_bundle.outputs.bundle_path }}
- name: Upload release asset
if: github.event_name == 'release'
# v2
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65
with:
files: ${{ steps.build_offline_bundle.outputs.bundle_path }}
build-offline-macos-arm64:
name: build-offline macos-arm64 (py3.11)
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install locked dependencies
uses: ./.github/actions/install-locked-env
with:
constraints-path: constraints/lock-macos-arm64-py311.txt
- name: Build and smoke test offline bundle
id: build_offline_bundle
uses: ./.github/actions/build-and-smoke-offline-bundle
with:
constraints-path: constraints/lock-macos-arm64-py311.txt
platform-id: macos-arm64
- name: Upload workflow artifact
uses: actions/upload-artifact@v4
with:
name: offline-macos-arm64
path: ${{ steps.build_offline_bundle.outputs.bundle_path }}
- name: Upload release asset
if: github.event_name == 'release'
# v2
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65
with:
files: ${{ steps.build_offline_bundle.outputs.bundle_path }}
build-offline-macos-x64:
name: build-offline macos-x64 (py3.11)
runs-on: [self-hosted, macOS, X64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install locked dependencies
uses: ./.github/actions/install-locked-env
with:
constraints-path: constraints/lock-macos-x64-py311.txt
- name: Build and smoke test offline bundle
id: build_offline_bundle
uses: ./.github/actions/build-and-smoke-offline-bundle
with:
constraints-path: constraints/lock-macos-x64-py311.txt
platform-id: macos-x64
- name: Upload workflow artifact
uses: actions/upload-artifact@v4
with:
name: offline-macos-x64
path: ${{ steps.build_offline_bundle.outputs.bundle_path }}
- name: Upload release asset
if: github.event_name == 'release'
# v2
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65
with:
files: ${{ steps.build_offline_bundle.outputs.bundle_path }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Release Offline Bundles on: release: types: [published] workflow_dispatch: permissions: contents: write jobs: build-wheel: timeout-minutes: 30 name: build-wheel (py3.11) runs-on: latchkey-small steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python 3.11 uses: actions/setup-python@v5 with: python-version: "3.11" cache: pip - name: Install build frontend run: python -m pip install --upgrade pip build - name: Build wheel run: python -m build --wheel - name: Resolve wheel path shell: bash run: | WHEEL_PATH="$(python - <<'PY' from pathlib import Path wheels = sorted(Path("dist").glob("dayu_agent-*.whl")) if len(wheels) != 1: raise SystemExit(f"unexpected wheels: {wheels}") print(wheels[0]) PY )" echo "WHEEL_PATH=$WHEEL_PATH" >> "$GITHUB_ENV" - name: Upload wheel artifact uses: actions/upload-artifact@v4 with: name: dayu-wheel path: ${{ env.WHEEL_PATH }} - name: Upload wheel release asset if: github.event_name == 'release' # v2 uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 with: files: ${{ env.WHEEL_PATH }} build-offline-windows-x64: timeout-minutes: 30 name: build-offline windows-x64 (py3.11) runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python 3.11 uses: actions/setup-python@v5 with: python-version: "3.11" cache: pip - name: Install locked dependencies uses: ./.github/actions/install-locked-env with: constraints-path: constraints/lock-windows-x64-py311.txt - name: Build and smoke test offline bundle id: build_offline_bundle uses: ./.github/actions/build-and-smoke-offline-bundle with: constraints-path: constraints/lock-windows-x64-py311.txt platform-id: windows-x64 - name: Upload workflow artifact uses: actions/upload-artifact@v4 with: name: offline-windows-x64 path: ${{ steps.build_offline_bundle.outputs.bundle_path }} - name: Upload release asset if: github.event_name == 'release' # v2 uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 with: files: ${{ steps.build_offline_bundle.outputs.bundle_path }} build-offline-macos-arm64: timeout-minutes: 30 name: build-offline macos-arm64 (py3.11) runs-on: macos-14 steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python 3.11 uses: actions/setup-python@v5 with: python-version: "3.11" cache: pip - name: Install locked dependencies uses: ./.github/actions/install-locked-env with: constraints-path: constraints/lock-macos-arm64-py311.txt - name: Build and smoke test offline bundle id: build_offline_bundle uses: ./.github/actions/build-and-smoke-offline-bundle with: constraints-path: constraints/lock-macos-arm64-py311.txt platform-id: macos-arm64 - name: Upload workflow artifact uses: actions/upload-artifact@v4 with: name: offline-macos-arm64 path: ${{ steps.build_offline_bundle.outputs.bundle_path }} - name: Upload release asset if: github.event_name == 'release' # v2 uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 with: files: ${{ steps.build_offline_bundle.outputs.bundle_path }} build-offline-macos-x64: timeout-minutes: 30 name: build-offline macos-x64 (py3.11) runs-on: [self-hosted, macOS, X64] steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python 3.11 uses: actions/setup-python@v5 with: python-version: "3.11" cache: pip - name: Install locked dependencies uses: ./.github/actions/install-locked-env with: constraints-path: constraints/lock-macos-x64-py311.txt - name: Build and smoke test offline bundle id: build_offline_bundle uses: ./.github/actions/build-and-smoke-offline-bundle with: constraints-path: constraints/lock-macos-x64-py311.txt platform-id: macos-x64 - name: Upload workflow artifact uses: actions/upload-artifact@v4 with: name: offline-macos-x64 path: ${{ steps.build_offline_bundle.outputs.bundle_path }} - name: Upload release asset if: github.event_name == 'release' # v2 uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 with: files: ${{ steps.build_offline_bundle.outputs.bundle_path }}
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.
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.