Skip to content
Latchkey

πŸš€ AutoPub Release workflow (strawberry-graphql/strawberry-django)

The πŸš€ AutoPub Release workflow from strawberry-graphql/strawberry-django, explained and optimized by Latchkey.

A

CI health: A - excellent

Point runs-on at Latchkey and get 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: strawberry-graphql/strawberry-django.github/workflows/release.ymlLicense MITView source

What it does

This is the πŸš€ AutoPub Release workflow from the strawberry-graphql/strawberry-django 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: πŸš€ AutoPub Release
concurrency: release

on:
  push:
    branches: [main]

permissions:
  contents: write
  id-token: write

jobs:
  check-release:
    name: πŸ“¦ Check for release
    runs-on: ubuntu-latest
    outputs:
      has_release: ${{ steps.check.outputs['has-release'] }}

    steps:
      - uses: actions/checkout@v4
        with:
          token: ${{ secrets.BOT_TOKEN }}

      - name: Check for release
        id: check
        uses: autopub/autopub-action@5fdc82e84c048a82303de6b5c5a9d027665e73cf # v1.1.1
        with:
          command: check
          autopub-version: "1.0.0a58"
          github-token: ${{ secrets.BOT_TOKEN }}
          extra-plugins: strawberry-autopub-plugins

      - name: Debug info
        run: |
          echo "GitHub ref: ${{ github.ref }}"
          echo "has_release: ${{ steps.check.outputs['has-release'] }}"

  publish:
    name: πŸ“¦ Publish to PyPI
    needs: check-release
    if: ${{ github.ref == 'refs/heads/main' && needs.check-release.outputs.has_release == 'true' }}
    runs-on: ubuntu-latest

    steps:
      - name: Debug info
        run: |
          echo "GitHub ref: ${{ github.ref }}"
          echo "has_release: ${{ needs.check-release.outputs.has_release }}"

      - uses: actions/checkout@v4
        with:
          token: ${{ secrets.BOT_TOKEN }}

      - name: Prepare release
        uses: autopub/autopub-action@5fdc82e84c048a82303de6b5c5a9d027665e73cf # v1.1.1
        with:
          command: prepare
          autopub-version: "1.0.0a58"
          extra-plugins: strawberry-autopub-plugins

      - name: Build package
        uses: autopub/autopub-action@5fdc82e84c048a82303de6b5c5a9d027665e73cf # v1.1.1
        with:
          command: build
          autopub-version: "1.0.0a58"
          extra-plugins: strawberry-autopub-plugins

      - name: Publish to PyPI
        uses: autopub/autopub-action@5fdc82e84c048a82303de6b5c5a9d027665e73cf # v1.1.1
        with:
          command: publish
          autopub-version: "1.0.0a58"
          extra-plugins: strawberry-autopub-plugins
          github-token: ${{ secrets.BOT_TOKEN }}
          git-username: botberry
          git-email: bot@strawberry.rocks
        env:
          TYPEFULLY_API_KEY: ${{ secrets.TYPEFULLY_API_KEY }}
          TYPEFULLY_SOCIAL_SET_ID: ${{ secrets.TYPEFULLY_SOCIAL_SET_ID }}

The same workflow, on Latchkey

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

name: πŸš€ AutoPub Release
concurrency: release
 
on:
  push:
    branches: [main]
 
permissions:
  contents: write
  id-token: write
 
jobs:
  check-release:
    timeout-minutes: 30
    name: πŸ“¦ Check for release
    runs-on: latchkey-small
    outputs:
      has_release: ${{ steps.check.outputs['has-release'] }}
 
    steps:
      - uses: actions/checkout@v4
        with:
          token: ${{ secrets.BOT_TOKEN }}
 
      - name: Check for release
        id: check
        uses: autopub/autopub-action@5fdc82e84c048a82303de6b5c5a9d027665e73cf # v1.1.1
        with:
          command: check
          autopub-version: "1.0.0a58"
          github-token: ${{ secrets.BOT_TOKEN }}
          extra-plugins: strawberry-autopub-plugins
 
      - name: Debug info
        run: |
          echo "GitHub ref: ${{ github.ref }}"
          echo "has_release: ${{ steps.check.outputs['has-release'] }}"
 
  publish:
    timeout-minutes: 30
    name: πŸ“¦ Publish to PyPI
    needs: check-release
    if: ${{ github.ref == 'refs/heads/main' && needs.check-release.outputs.has_release == 'true' }}
    runs-on: latchkey-small
 
    steps:
      - name: Debug info
        run: |
          echo "GitHub ref: ${{ github.ref }}"
          echo "has_release: ${{ needs.check-release.outputs.has_release }}"
 
      - uses: actions/checkout@v4
        with:
          token: ${{ secrets.BOT_TOKEN }}
 
      - name: Prepare release
        uses: autopub/autopub-action@5fdc82e84c048a82303de6b5c5a9d027665e73cf # v1.1.1
        with:
          command: prepare
          autopub-version: "1.0.0a58"
          extra-plugins: strawberry-autopub-plugins
 
      - name: Build package
        uses: autopub/autopub-action@5fdc82e84c048a82303de6b5c5a9d027665e73cf # v1.1.1
        with:
          command: build
          autopub-version: "1.0.0a58"
          extra-plugins: strawberry-autopub-plugins
 
      - name: Publish to PyPI
        uses: autopub/autopub-action@5fdc82e84c048a82303de6b5c5a9d027665e73cf # v1.1.1
        with:
          command: publish
          autopub-version: "1.0.0a58"
          extra-plugins: strawberry-autopub-plugins
          github-token: ${{ secrets.BOT_TOKEN }}
          git-username: botberry
          git-email: bot@strawberry.rocks
        env:
          TYPEFULLY_API_KEY: ${{ secrets.TYPEFULLY_API_KEY }}
          TYPEFULLY_SOCIAL_SET_ID: ${{ secrets.TYPEFULLY_SOCIAL_SET_ID }}
 

What changed

This workflow runs 2 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