Skip to content
Latchkey

Publish to PyPI workflow (fuzzylabs/sre-agent)

The Publish to PyPI workflow from fuzzylabs/sre-agent, explained and optimized by Latchkey.

D

CI health: D - needs work

Point runs-on at Latchkey and get caching, run de-duplication, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: fuzzylabs/sre-agent.github/workflows/publish.ymlLicense MITView source

What it does

This is the Publish to PyPI workflow from the fuzzylabs/sre-agent 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 to PyPI

on:
  push:
    tags:
      - "[0-9]*"

jobs:
  publish:
    name: Publish to PyPI
    runs-on: ubuntu-latest
    timeout-minutes: 10
    environment: pypi
    permissions:
      id-token: write

    steps:
      - uses: actions/checkout@v6

      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version-file: "pyproject.toml"

      - name: Install uv
        uses: astral-sh/setup-uv@v7
        with:
          version: "0.10.9"

      - name: Build package
        run: uv build

      - name: Publish to PyPI
        run: uv publish --trusted-publishing always

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: Publish to PyPI
 
on:
  push:
    tags:
      - "[0-9]*"
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  publish:
    name: Publish to PyPI
    runs-on: latchkey-small
    timeout-minutes: 10
    environment: pypi
    permissions:
      id-token: write
 
    steps:
      - uses: actions/checkout@v6
 
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          cache: 'pip'
          python-version-file: "pyproject.toml"
 
      - name: Install uv
        uses: astral-sh/setup-uv@v7
        with:
          version: "0.10.9"
 
      - name: Build package
        run: uv build
 
      - name: Publish to PyPI
        run: uv publish --trusted-publishing always
 

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.

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow