softprops/action-gh-release
Create a GitHub Release and upload assets when you push a tag.
What it does
softprops/action-gh-release creates or updates a GitHub Release for the tag that triggered the run and uploads any files you point it at.
It can generate release notes from merged PRs, so a tag push becomes a full release with binaries attached.
Usage
workflow (.yml)
on:
push:
tags: ['v*']
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: trueInputs
| Input | Description | Default | Required |
|---|---|---|---|
files | Glob(s) of asset files to attach. | - | No |
tag_name | Tag for the release. | triggering tag | No |
body | Release notes body. | - | No |
draft | Create as a draft. | false | No |
prerelease | Mark as a prerelease. | false | No |
generate_release_notes | Auto-generate notes from PRs. | false | No |
Outputs
| Output | Description |
|---|---|
url | URL of the created release. |
id | Release ID. |
Notes
This runs on a tag push. The job needs permissions: contents: write.
Common errors
Resource not accessible by integrationmeans the job lackscontents: write.- A release with no tag usually means the workflow was not triggered by a tag push and no
tag_namewas set.
Security and pinning
- Pin to a commit SHA.
Frequently asked questions
How do I attach build artifacts to a GitHub Release?
Build them in earlier steps, then pass a glob to
files, for example dist/*, with contents: write permission.