Skip to content
Latchkey

Publish workflow (encode/httpx)

The Publish workflow from encode/httpx, explained and optimized by Latchkey.

C

CI health: C - fair

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: encode/httpx.github/workflows/publish.ymlLicense BSD-3-ClauseView source

What it does

This is the Publish workflow from the encode/httpx repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Publish

on:
  push:
    tags:
      - '*'

jobs:
  publish:
    name: "Publish release"
    runs-on: "ubuntu-latest"

    environment:
       name: deploy

    steps:
      - uses: "actions/checkout@v4"
      - uses: "actions/setup-python@v6"
        with:
          python-version: 3.9
      - name: "Install dependencies"
        run: "scripts/install"
      - name: "Build package & docs"
        run: "scripts/build"
      - name: "Publish to PyPI & deploy docs"
        run: "scripts/publish"
        env:
          TWINE_USERNAME: __token__
          TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Publish
 
on:
  push:
    tags:
      - '*'
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  publish:
    timeout-minutes: 30
    name: "Publish release"
    runs-on: "ubuntu-latest"
 
    environment:
       name: deploy
 
    steps:
      - uses: "actions/checkout@v4"
      - uses: "actions/setup-python@v6"
        with:
          python-version: 3.9
      - name: "Install dependencies"
        run: "scripts/install"
      - name: "Build package & docs"
        run: "scripts/build"
      - name: "Publish to PyPI & deploy docs"
        run: "scripts/publish"
        env:
          TWINE_USERNAME: __token__
          TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
 

What changed

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