Skip to content
Latchkey

Release workflow (pndurette/gTTS)

The Release workflow from pndurette/gTTS, explained and optimized by Latchkey.

F

CI health: F - at risk

Point runs-on at Latchkey and get caching, 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: pndurette/gTTS.github/workflows/release.ymlLicense MITView source

What it does

This is the Release workflow from the pndurette/gTTS 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

on:
  push:
    branches:
      - main

jobs:
  release-please:
    runs-on: ubuntu-latest
    permissions:
      # For release-please:
      pull-requests: write
      contents: write
      # IMPORTANT: this permission is mandatory for trusted publishing
      # https://docs.pypi.org/trusted-publishers/using-a-publisher/
      id-token: write
    environment:
      # Environment to narrow down the publish scope
      name: production
      url: https://pypi.org/project/gTTS/${{ steps.release.outputs.tag_name }}/

    steps:
      - name: Release Please
        uses: google-github-actions/release-please-action@v4
        id: release

      # Only do the rest (package build/push) if a release was created
      - name: Checkout
        if: ${{ steps.release.outputs.release_created }}
        uses: actions/checkout@v4
      - name: Setup Python
        if: ${{ steps.release.outputs.release_created }}
        uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - name: Install build dependencies
        if: ${{ steps.release.outputs.release_created }}
        run: |
          pip install --upgrade pip
          pip install build
      - name: Build package
        if: ${{ steps.release.outputs.release_created }}
        run: python -m build
      - name: Publish package
        if: ${{ steps.release.outputs.release_created }}
        uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc

# References:
# * Release Please:
#   https://github.com/googleapis/release-please
# * Release Please (GitHub Action)
#   https://github.com/google-github-actions/release-please-action
# * Conventional Commits:
#   https://www.conventionalcommits.org/

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: Release
 
on:
  push:
    branches:
      - main
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  release-please:
    timeout-minutes: 30
    runs-on: latchkey-small
    permissions:
      # For release-please:
      pull-requests: write
      contents: write
      # IMPORTANT: this permission is mandatory for trusted publishing
      # https://docs.pypi.org/trusted-publishers/using-a-publisher/
      id-token: write
    environment:
      # Environment to narrow down the publish scope
      name: production
      url: https://pypi.org/project/gTTS/${{ steps.release.outputs.tag_name }}/
 
    steps:
      - name: Release Please
        uses: google-github-actions/release-please-action@v4
        id: release
 
      # Only do the rest (package build/push) if a release was created
      - name: Checkout
        if: ${{ steps.release.outputs.release_created }}
        uses: actions/checkout@v4
      - name: Setup Python
        if: ${{ steps.release.outputs.release_created }}
        uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: "3.12"
      - name: Install build dependencies
        if: ${{ steps.release.outputs.release_created }}
        run: |
          pip install --upgrade pip
          pip install build
      - name: Build package
        if: ${{ steps.release.outputs.release_created }}
        run: python -m build
      - name: Publish package
        if: ${{ steps.release.outputs.release_created }}
        uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc
 
# References:
# * Release Please:
#   https://github.com/googleapis/release-please
# * Release Please (GitHub Action)
#   https://github.com/google-github-actions/release-please-action
# * Conventional Commits:
#   https://www.conventionalcommits.org/

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 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