Skip to content
Latchkey

Deploy workflow (pmorissette/bt)

The Deploy workflow from pmorissette/bt, explained and optimized by Latchkey.

F

CI health: F - at risk

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: pmorissette/bt.github/workflows/deploy.yamlLicense MITView source

What it does

This is the Deploy workflow from the pmorissette/bt 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: Deploy

on:
  push:
    tags:
      - 'v*'
  workflow_dispatch:

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest
        python-version:
          - "3.10"
          - "3.11"
          - "3.12"
          - "3.13"
          - "3.14"
        include:
          - python-version: "3.10"
            cibuildwheel: "cp310"
          - python-version: "3.11"
            cibuildwheel: "cp311"
          - python-version: "3.12"
            cibuildwheel: "cp312"
          - python-version: "3.13"
            cibuildwheel: "cp313"
          - python-version: "3.14"
            cibuildwheel: "cp314"

    steps:
    - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

    - uses: actions-ext/python/setup@main
      with:
        version: ${{ matrix.python-version }}

    - name: Install dependencies
      run: |
        make develop
        python -m pip install -U wheel twine setuptools

    - name: Install cibuildwheel
      run: python -m pip install cibuildwheel

    - name: Set up QEMU
      uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
      with:
        platforms: all
      if: runner.os == 'Linux'

    - name: Python Wheel Steps (Linux - cibuildwheel)
      run: python -m cibuildwheel --output-dir dist
      env:
        CIBW_BUILD: "${{ matrix.cibuildwheel }}-manylinux*"
        CIBW_ARCHS_LINUX: x86_64 aarch64
        CIBW_BUILD_VERBOSITY: 3
      if: ${{ runner.os == 'Linux' }}

    - name: Python Build Steps (Macos)
      run: python -m cibuildwheel --output-dir dist
      env:
        CIBW_BUILD: "${{ matrix.cibuildwheel }}-macos*"
        CIBW_ARCHS_MACOS: x86_64 arm64
        CIBW_BUILD_VERBOSITY: 3
      if: ${{ matrix.os == 'macos-latest' }}

    - name: Python Build Steps (Windows)
      run: python -m cibuildwheel --output-dir dist
      env:
        CIBW_BUILD: "${{ matrix.cibuildwheel }}-win_amd64"
      if: ${{ matrix.os == 'windows-latest' }}

    - name: Check Wheels
      run: twine check dist/*

    - name: Upload Wheel
      uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
      with:
        name: wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}
        path: dist/*.whl

    # - name: Publish distribution 📦 to PyPI
    #   if: ${{ startsWith(github.ref, 'refs/tags') && matrix.os != 'ubuntu-latest' }}
    #   env:
    #     TWINE_USERNAME: ${{ secrets.PYPI_UN }}
    #     TWINE_PASSWORD: ${{ secrets.PYPI_PW }}
    #   run: make upload
  build_sdist:
    strategy:
      matrix:
        os:
          - ubuntu-latest
        python-version:
          - '3.10'

    runs-on: ${{ matrix.os }}

    steps:
      - name: Checkout
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          submodules: recursive

      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1  # v6.3.0
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install dependencies
        run: make develop

      - name: Python SDist Steps
        run: python -m build -s

      - name: Check sdist
        run: twine check dist/*.tar.gz

      - name: Upload SDist
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
            name: sdist
            path: dist/*.tar.gz

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: Deploy
 
on:
  push:
    tags:
      - 'v*'
  workflow_dispatch:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest
        python-version:
          - "3.10"
          - "3.11"
          - "3.12"
          - "3.13"
          - "3.14"
        include:
          - python-version: "3.10"
            cibuildwheel: "cp310"
          - python-version: "3.11"
            cibuildwheel: "cp311"
          - python-version: "3.12"
            cibuildwheel: "cp312"
          - python-version: "3.13"
            cibuildwheel: "cp313"
          - python-version: "3.14"
            cibuildwheel: "cp314"
 
    steps:
    - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
 
    - uses: actions-ext/python/setup@main
      with:
        version: ${{ matrix.python-version }}
 
    - name: Install dependencies
      run: |
        make develop
        python -m pip install -U wheel twine setuptools
 
    - name: Install cibuildwheel
      run: python -m pip install cibuildwheel
 
    - name: Set up QEMU
      uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
      with:
        platforms: all
      if: runner.os == 'Linux'
 
    - name: Python Wheel Steps (Linux - cibuildwheel)
      run: python -m cibuildwheel --output-dir dist
      env:
        CIBW_BUILD: "${{ matrix.cibuildwheel }}-manylinux*"
        CIBW_ARCHS_LINUX: x86_64 aarch64
        CIBW_BUILD_VERBOSITY: 3
      if: ${{ runner.os == 'Linux' }}
 
    - name: Python Build Steps (Macos)
      run: python -m cibuildwheel --output-dir dist
      env:
        CIBW_BUILD: "${{ matrix.cibuildwheel }}-macos*"
        CIBW_ARCHS_MACOS: x86_64 arm64
        CIBW_BUILD_VERBOSITY: 3
      if: ${{ matrix.os == 'macos-latest' }}
 
    - name: Python Build Steps (Windows)
      run: python -m cibuildwheel --output-dir dist
      env:
        CIBW_BUILD: "${{ matrix.cibuildwheel }}-win_amd64"
      if: ${{ matrix.os == 'windows-latest' }}
 
    - name: Check Wheels
      run: twine check dist/*
 
    - name: Upload Wheel
      uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
      with:
        name: wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}
        path: dist/*.whl
 
    # - name: Publish distribution 📦 to PyPI
    #   if: ${{ startsWith(github.ref, 'refs/tags') && matrix.os != 'ubuntu-latest' }}
    #   env:
    #     TWINE_USERNAME: ${{ secrets.PYPI_UN }}
    #     TWINE_PASSWORD: ${{ secrets.PYPI_PW }}
    #   run: make upload
  build_sdist:
    timeout-minutes: 30
    strategy:
      matrix:
        os:
          - ubuntu-latest
        python-version:
          - '3.10'
 
    runs-on: ${{ matrix.os }}
 
    steps:
      - name: Checkout
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          submodules: recursive
 
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1  # v6.3.0
        with:
          cache: 'pip'
          python-version: ${{ matrix.python-version }}
 
      - name: Install dependencies
        run: make develop
 
      - name: Python SDist Steps
        run: python -m build -s
 
      - name: Check sdist
        run: twine check dist/*.tar.gz
 
      - name: Upload SDist
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
            name: sdist
            path: dist/*.tar.gz
 

What changed

1 third-party action is referenced by a movable tag. Pin it 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:

This workflow runs 2 jobs (16 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow