Skip to content
Latchkey

Release Python packages workflow (NomaDamas/k-skill)

The Release Python packages workflow from NomaDamas/k-skill, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, 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: NomaDamas/k-skill.github/workflows/release-python.ymlLicense MITView source

What it does

This is the Release Python packages workflow from the NomaDamas/k-skill 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: Release Python packages

on:
  push:
    branches:
      - main
    paths:
      - ".github/release-please/**"
      - ".github/workflows/release-python.yml"
      - "python-packages/**"
  workflow_dispatch:

permissions:
  contents: write
  pull-requests: write
  id-token: write

jobs:
  detect_python_packages:
    runs-on: ubuntu-latest
    outputs:
      has_python_packages: ${{ steps.detect.outputs.has_python_packages }}
    steps:
      - uses: actions/checkout@v5
      - id: detect
        shell: bash
        run: |
          if find python-packages -mindepth 2 -maxdepth 2 -name pyproject.toml -print -quit | grep -q .; then
            echo "has_python_packages=true" >> "$GITHUB_OUTPUT"
          else
            echo "has_python_packages=false" >> "$GITHUB_OUTPUT"
          fi

  scaffold-only:
    needs: detect_python_packages
    if: ${{ needs.detect_python_packages.outputs.has_python_packages != 'true' }}
    runs-on: ubuntu-latest
    steps:
      - run: echo "No Python package exists yet. release-please remains scaffold-only."

  release:
    needs: detect_python_packages
    if: ${{ needs.detect_python_packages.outputs.has_python_packages == 'true' }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5

      - id: release
        uses: googleapis/release-please-action@v5
        with:
          config-file: .github/release-please/python-config.json
          manifest-file: .github/release-please/python-manifest.json

      - name: Reminder
        if: ${{ steps.release.outputs.releases_created == 'true' }}
        run: |
          echo "Python package release metadata was created."
          echo "Wire package-specific build/publish steps here when the first python package is added."

The same workflow, on Latchkey

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

name: Release Python packages
 
on:
  push:
    branches:
      - main
    paths:
      - ".github/release-please/**"
      - ".github/workflows/release-python.yml"
      - "python-packages/**"
  workflow_dispatch:
 
permissions:
  contents: write
  pull-requests: write
  id-token: write
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  detect_python_packages:
    timeout-minutes: 30
    runs-on: latchkey-small
    outputs:
      has_python_packages: ${{ steps.detect.outputs.has_python_packages }}
    steps:
      - uses: actions/checkout@v5
      - id: detect
        shell: bash
        run: |
          if find python-packages -mindepth 2 -maxdepth 2 -name pyproject.toml -print -quit | grep -q .; then
            echo "has_python_packages=true" >> "$GITHUB_OUTPUT"
          else
            echo "has_python_packages=false" >> "$GITHUB_OUTPUT"
          fi
 
  scaffold-only:
    timeout-minutes: 30
    needs: detect_python_packages
    if: ${{ needs.detect_python_packages.outputs.has_python_packages != 'true' }}
    runs-on: latchkey-small
    steps:
      - run: echo "No Python package exists yet. release-please remains scaffold-only."
 
  release:
    timeout-minutes: 30
    needs: detect_python_packages
    if: ${{ needs.detect_python_packages.outputs.has_python_packages == 'true' }}
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v5
 
      - id: release
        uses: googleapis/release-please-action@v5
        with:
          config-file: .github/release-please/python-config.json
          manifest-file: .github/release-please/python-manifest.json
 
      - name: Reminder
        if: ${{ steps.release.outputs.releases_created == 'true' }}
        run: |
          echo "Python package release metadata was created."
          echo "Wire package-specific build/publish steps here when the first python package is added."
 

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 3 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow