How to Create a GitHub Release from a Tag in GitHub Actions
A tag push can build artifacts and publish a Release with generated notes in one run.
Trigger on push tags matching v*, build the artifacts, then create the Release with softprops/action-gh-release.
Steps
- Trigger on tags matching your version pattern.
- Build the artifacts to attach.
- Create the Release with generated notes and the artifact files.
Workflow
.github/workflows/release.yml
on:
push:
tags: ['v*']
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make dist
- uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: dist/*Gotchas
- Push an annotated tag; lightweight tags can produce sparse notes.
- The job needs
contents: writeto create the Release.
Related guides
How to Run a Workflow Only on Tags in GitHub ActionsTrigger a GitHub Actions workflow only when a Git tag is pushed using on.push.tags, ideal for release pipelin…
How to Publish a Python Package to PyPI in GitHub ActionsPublish a Python package to PyPI from GitHub Actions using trusted publishing (OIDC) and pypa/gh-action-pypi-…