Skip to content
Latchkey

Release workflow (kivymd/KivyMD)

The Release workflow from kivymd/KivyMD, explained and optimized by Latchkey.

D

CI health: D - needs work

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

Grade your own workflow free or run it on Latchkey →
Source: kivymd/KivyMD.github/workflows/release.ymlLicense MITView source

What it does

This is the Release workflow from the kivymd/KivyMD 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-ignore:
      - data
      - gh-pages
    tags:
      - '**'
  pull_request:
    branches-ignore:
      - data
      - gh-pages
  workflow_dispatch:
    inputs:
      version:
        description: New version in format n.n.n (1.111.11)
        required: true
      next_version:
        description: Next development version in format n.n.n.devn (1.111.11.dev0). USE ONLY FOR MAJOR DEVELOPMENT VERSIONS (2.0.0.dev0). DON'T WRITE ANYTHING HERE
        required: false

jobs:

  # Release job. Runs make_release.py tool. Pushes changes only on dispatch_event
  release:
    name: Release
    runs-on: ubuntu-latest
    env:
      PYTHONUNBUFFERED: 1

    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        fetch-depth: 0
        persist-credentials: ${{ github.event_name != 'workflow_dispatch' }}  # Allow using PAT when making release

    - name: Set up Python 3.13
      uses: actions/setup-python@v5
      with:
        python-version: '3.13'
        architecture: x64

    - name: Set up environment
      run: |
        git config user.name "KivyMD Bot"
        git config user.email 69076719+KivyMD-Bot@users.noreply.github.com
        pip install -e .
        pip install pre-commit

    - name: Release
      if: github.event_name == 'workflow_dispatch'
      run: |
        # Use personal token to push (when using GITHUB_TOKEN, it will not run workflows)
        git remote set-url origin https://KivyMD-Bot:${{ secrets.GH_PAT }}@github.com/${{ github.repository }}
        python kivymd/tools/release/make_release.py release "${{ github.event.inputs.version }}" "${{ github.event.inputs.next_version }}" --yes --push

    - name: Release preparation
      if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.event_name != 'workflow_dispatch'
      run: |
        # Use personal token to push
        git remote set-url origin https://KivyMD-Bot:${{ secrets.GH_PAT }}@github.com/${{ github.repository }}
        python kivymd/tools/release/make_release.py prepare --yes --push
        git format-patch origin/master... --stdout

    - name: Release test
      if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/master' && github.event_name != 'workflow_dispatch')
      run: |
        python kivymd/tools/release/make_release.py test --yes
        git format-patch origin/master... --stdout
        git format-patch origin/master... --stdout > release_test.patch

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-ignore:
      - data
      - gh-pages
    tags:
      - '**'
  pull_request:
    branches-ignore:
      - data
      - gh-pages
  workflow_dispatch:
    inputs:
      version:
        description: New version in format n.n.n (1.111.11)
        required: true
      next_version:
        description: Next development version in format n.n.n.devn (1.111.11.dev0). USE ONLY FOR MAJOR DEVELOPMENT VERSIONS (2.0.0.dev0). DON'T WRITE ANYTHING HERE
        required: false
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
 
  # Release job. Runs make_release.py tool. Pushes changes only on dispatch_event
  release:
    timeout-minutes: 30
    name: Release
    runs-on: latchkey-small
    env:
      PYTHONUNBUFFERED: 1
 
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        fetch-depth: 0
        persist-credentials: ${{ github.event_name != 'workflow_dispatch' }}  # Allow using PAT when making release
 
    - name: Set up Python 3.13
      uses: actions/setup-python@v5
      with:
        cache: 'pip'
        python-version: '3.13'
        architecture: x64
 
    - name: Set up environment
      run: |
        git config user.name "KivyMD Bot"
        git config user.email 69076719+KivyMD-Bot@users.noreply.github.com
        pip install -e .
        pip install pre-commit
 
    - name: Release
      if: github.event_name == 'workflow_dispatch'
      run: |
        # Use personal token to push (when using GITHUB_TOKEN, it will not run workflows)
        git remote set-url origin https://KivyMD-Bot:${{ secrets.GH_PAT }}@github.com/${{ github.repository }}
        python kivymd/tools/release/make_release.py release "${{ github.event.inputs.version }}" "${{ github.event.inputs.next_version }}" --yes --push
 
    - name: Release preparation
      if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.event_name != 'workflow_dispatch'
      run: |
        # Use personal token to push
        git remote set-url origin https://KivyMD-Bot:${{ secrets.GH_PAT }}@github.com/${{ github.repository }}
        python kivymd/tools/release/make_release.py prepare --yes --push
        git format-patch origin/master... --stdout
 
    - name: Release test
      if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/master' && github.event_name != 'workflow_dispatch')
      run: |
        python kivymd/tools/release/make_release.py test --yes
        git format-patch origin/master... --stdout
        git format-patch origin/master... --stdout > release_test.patch
 

What changed

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