How to Create a GitHub Release on Tag Push in GitHub Actions
A workflow filtered on tag pushes can create the matching GitHub Release in one step with softprops/action-gh-release.
Filter on.push.tags, grant contents: write, and run softprops/action-gh-release. It creates a Release for the pushed tag and can generate notes for you.
Steps
- Trigger on
push.tagsmatching your version glob. - Grant
contents: writeso the job can create the release. - Run
softprops/action-gh-releasewithgenerate_release_notes: true.
Workflow
.github/workflows/release.yml
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: softprops/action-gh-release@v2
with:
generate_release_notes: trueGotchas
- Without
contents: writethe release create call fails with a 403. - The action uses
github.ref_nameas the tag by default; settag_nameto override it.
Related guides
How to Attach Build Artifacts to a Release in GitHub ActionsUpload build outputs as GitHub Release assets in GitHub Actions by passing a files glob to softprops/action-g…
How to Auto-Generate Release Notes From PRs in GitHub ActionsGenerate release notes from merged pull requests using GitHub native auto-generated notes via generate_releas…