Skip to content
Latchkey

Release package workflow (gdsfactory/gdsfactory)

The Release package workflow from gdsfactory/gdsfactory, 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: gdsfactory/gdsfactory.github/workflows/release.ymlLicense MITView source

What it does

This is the Release package workflow from the gdsfactory/gdsfactory 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 package
on:
  push:
    tags: "v*"
permissions:
  contents: read
jobs:
  release_pypi:
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7.0.0
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version: 3.x
          cache-dependency-path: pyproject.toml
      - name: Install uv
        uses: astral-sh/setup-uv@v7
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install setuptools wheel twine
      - name: Build and publish
        env:
          TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
          TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
        run: |
          make build
          twine upload dist/*
  release_docker:
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
    needs: release_pypi
    runs-on: ubuntu-latest
    permissions: {}
    steps:
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v4.1.0
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v4
      - name: Login to DockerHub
        uses: docker/login-action@v4
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      - name: Build and push
        id: docker_build
        uses: docker/build-push-action@v7
        with:
          push: true
          tags: ${{ secrets.DOCKERHUB_USERNAME }}/gdsfactory:latest,${{ secrets.DOCKERHUB_USERNAME }}/gdsfactory:9.45.0
          file: .devcontainer/Dockerfile.dev
  release_environment:
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v7.0.0
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version: '3.11'
          cache: "pip"
          cache-dependency-path: pyproject.toml
      - name: Install dependencies
        run: |
          pip install .
          pip freeze > requirements.txt
      - name: Publish Latest Draft
        run: |
          gh release edit ${{ github.ref_name }} --draft=false
          gh release upload ${{ github.ref_name }} requirements.txt --clobber
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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 package
on:
  push:
    tags: "v*"
permissions:
  contents: read
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  release_pypi:
    timeout-minutes: 30
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v7.0.0
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          cache: 'pip'
          python-version: 3.x
          cache-dependency-path: pyproject.toml
      - name: Install uv
        uses: astral-sh/setup-uv@v7
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install setuptools wheel twine
      - name: Build and publish
        env:
          TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
          TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
        run: |
          make build
          twine upload dist/*
  release_docker:
    timeout-minutes: 30
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
    needs: release_pypi
    runs-on: latchkey-small
    permissions: {}
    steps:
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v4.1.0
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v4
      - name: Login to DockerHub
        uses: docker/login-action@v4
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      - name: Build and push
        id: docker_build
        uses: docker/build-push-action@v7
        with:
          push: true
          tags: ${{ secrets.DOCKERHUB_USERNAME }}/gdsfactory:latest,${{ secrets.DOCKERHUB_USERNAME }}/gdsfactory:9.45.0
          file: .devcontainer/Dockerfile.dev
  release_environment:
    timeout-minutes: 30
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
    runs-on: latchkey-small
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v7.0.0
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version: '3.11'
          cache: "pip"
          cache-dependency-path: pyproject.toml
      - name: Install dependencies
        run: |
          pip install .
          pip freeze > requirements.txt
      - name: Publish Latest Draft
        run: |
          gh release edit ${{ github.ref_name }} --draft=false
          gh release upload ${{ github.ref_name }} requirements.txt --clobber
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 

What changed

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

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