Auto Release workflow (mietzen/porkbun-ddns)
The Auto Release workflow from mietzen/porkbun-ddns, explained and optimized by Latchkey.
C
CI health: C - fair
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the Auto Release workflow from the mietzen/porkbun-ddns 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: "Auto Release"
on:
pull_request:
types:
- closed
jobs:
auto-release:
if: github.event.pull_request.merged == true && github.event.pull_request.user.login == 'dependabot[bot]' && contains(github.event.pull_request.labels.*.name, 'docker')
name: "Auto Release"
runs-on: "ubuntu-latest"
steps:
- id: get-version
run: |
LATEST_TAG=$(curl -s "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest" | jq -r '.name')
URL='https://gist.githubusercontent.com/mietzen/cd33efb65f91619201a45ac50dcfc29e/raw/bump-version'
echo "version=v$(wget -qO - ${URL} | bash -s ${LATEST_TAG} bug)" >> $GITHUB_OUTPUT
- uses: actions/create-github-app-token@v3
id: generate-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: "softprops/action-gh-release@v3"
with:
token: ${{ steps.generate-token.outputs.token }}
tag_name: ${{ steps.get-version.outputs.version }}
generate_release_notes: true
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: "Auto Release" on: pull_request: types: - closed concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: auto-release: timeout-minutes: 30 if: github.event.pull_request.merged == true && github.event.pull_request.user.login == 'dependabot[bot]' && contains(github.event.pull_request.labels.*.name, 'docker') name: "Auto Release" runs-on: "ubuntu-latest" steps: - id: get-version run: | LATEST_TAG=$(curl -s "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest" | jq -r '.name') URL='https://gist.githubusercontent.com/mietzen/cd33efb65f91619201a45ac50dcfc29e/raw/bump-version' echo "version=v$(wget -qO - ${URL} | bash -s ${LATEST_TAG} bug)" >> $GITHUB_OUTPUT - uses: actions/create-github-app-token@v3 id: generate-token with: app-id: ${{ secrets.APP_ID }} private-key: ${{ secrets.APP_PRIVATE_KEY }} - uses: "softprops/action-gh-release@v3" with: token: ${{ steps.generate-token.outputs.token }} tag_name: ${{ steps.get-version.outputs.version }} generate_release_notes: true
What changed
- Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.