Skip to content
Latchkey

How to Trigger a Workflow When a Release Is Published in GitHub Actions

The release event with the published type fires when a draft or new release is published, giving you the release metadata in the payload.

Add on.release with types: [published]. Read the tag and upload URL from github.event.release, which is useful for attaching build artifacts to the release.

Steps

  • Add release: under on with types: [published].
  • Read github.event.release.tag_name for the version.
  • Attach assets with the GitHub CLI or an upload action.

Workflow

.github/workflows/release-assets.yml
on:
  release:
    types: [published]
jobs:
  assets:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci && npm run build
      - run: gh release upload "${{ github.event.release.tag_name }}" dist/*.zip
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Gotchas

  • Creating a draft release fires created, not published; use the type that matches your flow.
  • If the release is created by another workflow using GITHUB_TOKEN, it will not trigger this one, by design.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →