π AutoPub Release workflow (strawberry-graphql/strawberry-django)
The π AutoPub Release workflow from strawberry-graphql/strawberry-django, explained and optimized by Latchkey.
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.
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
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
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.