Skip to content
Latchkey

Publish Python package workflow (Spenhouet/confluence-markdown-exporter)

The Publish Python package workflow from Spenhouet/confluence-markdown-exporter, explained and optimized by Latchkey.

B

CI health: B - good

Point runs-on at Latchkey and get job timeouts, 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: Spenhouet/confluence-markdown-exporter.github/workflows/python-publish.ymlLicense MITView source

What it does

This is the Publish Python package workflow from the Spenhouet/confluence-markdown-exporter 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 Python package

on:
  workflow_call:
    inputs:
      version:
        description: "Release version to publish (e.g. 5.1.0)"
        required: true
        type: string
  workflow_dispatch:
    inputs:
      version:
        description: "Release version to publish (e.g. 5.1.0). Must match an existing git tag."
        required: true
        type: string

permissions:
  contents: write
  id-token: write
  attestations: write

jobs:
  publish:
    name: Publish to PyPI
    runs-on: ubuntu-latest
    environment:
      name: release
      url: https://pypi.org/p/confluence-markdown-exporter
    steps:
      - name: Checkout release tag
        uses: actions/checkout@v7
        with:
          ref: ${{ inputs.version }}

      - name: Install uv
        uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true

      - name: Install dependencies
        run: uv sync --locked --all-groups

      - name: Build distributions
        run: uv build --no-sources

      - name: Generate artifact attestations
        uses: actions/attest-build-provenance@v4.1.1
        with:
          subject-path: "dist/*"

      - name: Publish to PyPI
        run: uv publish

      - name: Sign the distributions with Sigstore
        uses: sigstore/gh-action-sigstore-python@v3.4.0
        with:
          inputs: >-
            ./dist/*.tar.gz
            ./dist/*.whl

      - name: Upload signed artifacts to GitHub Release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh release upload "${{ inputs.version }}" dist/** \
            --repo "$GITHUB_REPOSITORY"

The same workflow, on Latchkey

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

name: Publish Python package
 
on:
  workflow_call:
    inputs:
      version:
        description: "Release version to publish (e.g. 5.1.0)"
        required: true
        type: string
  workflow_dispatch:
    inputs:
      version:
        description: "Release version to publish (e.g. 5.1.0). Must match an existing git tag."
        required: true
        type: string
 
permissions:
  contents: write
  id-token: write
  attestations: write
 
jobs:
  publish:
    timeout-minutes: 30
    name: Publish to PyPI
    runs-on: latchkey-small
    environment:
      name: release
      url: https://pypi.org/p/confluence-markdown-exporter
    steps:
      - name: Checkout release tag
        uses: actions/checkout@v7
        with:
          ref: ${{ inputs.version }}
 
      - name: Install uv
        uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true
 
      - name: Install dependencies
        run: uv sync --locked --all-groups
 
      - name: Build distributions
        run: uv build --no-sources
 
      - name: Generate artifact attestations
        uses: actions/attest-build-provenance@v4.1.1
        with:
          subject-path: "dist/*"
 
      - name: Publish to PyPI
        run: uv publish
 
      - name: Sign the distributions with Sigstore
        uses: sigstore/gh-action-sigstore-python@v3.4.0
        with:
          inputs: >-
            ./dist/*.tar.gz
            ./dist/*.whl
 
      - name: Upload signed artifacts to GitHub Release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh release upload "${{ inputs.version }}" dist/** \
            --repo "$GITHUB_REPOSITORY"
 

What changed

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.

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