Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
A

action-gh-release

> 开发工具
Open source

:octocat: GitHub Action for creating GitHub Releases

5.7K stars0 likes3 views
WebsiteGitHub

About

:octocat: GitHub Action for creating GitHub Releases

action gh-release

A GitHub Action for creating GitHub Releases on Linux, Windows, and macOS virtual environments


  • Usage
    • Limit releases to pushes to tags
    • ⬆️ Uploading release assets
    • External release notes
    • Customizing
      • inputs
      • outputs
      • environment variables
    • Permissions

Usage

Limit releases to pushes to tags

Typically usage of this action involves adding a step to a build that is gated pushes to git tags. You may find step.if field helpful in accomplishing this as it maximizes the reuse value of your workflow for non-tag pushes.

v2.6.2 is the final v2 release and is no longer maintained or supported. It uses the Node 20 runtime deprecated by GitHub Actions. Upgrade to v3, which runs on Node 24. If a problem still reproduces on the latest v3, open a new issue with the exact action ref, workflow run URL, runner, and relevant logs.

Below is a simple example of step.if tag gating

yaml
name: Main

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Release
        uses: softprops/action-gh-release@v3
        if: github.ref_type == 'tag'

You can also use push config tag filter

yaml
name: Main

on:
  push:
    tags:
      - "v*.*.*"

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Release
        uses: softprops/action-gh-release@v3

⬆️ Uploading release assets

You can configure a number of options for your GitHub release and all are optional.

A common case for GitHub releases is to upload your binary after its been validated and packaged. Use the with.files input to declare a newline-delimited list of glob expressions matching the files you wish to upload to GitHub releases. If you'd like you can just list the files by name directly. If a tag already has a GitHub release, the existing release will be updated with the release assets.

Below is an example of uploading a single asset named Release.txt

yaml
name: Main

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Build
        run: echo ${{ github.sha }} > Release.txt
      - name: Test
        run: cat Release.txt
      - name: Release
        uses: softprops/action-gh-release@v3
        if: github.ref_type == 'tag'
        with:
          files: Release.txt

Below is an example of uploading more than one asset with a GitHub release

yaml
name: Main

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Build
        run: echo ${{ github.sha }} > Release.txt
      - name: Test
        run: cat Release.txt
      - name: Release
        uses: softprops/action-gh-release@v3
        if: github.ref_type == 'tag'
        with:
          files: |
            Release.txt
            LICENSE

⚠️ Note: Notice the | in the yaml syntax above ☝️. That lets you effectively declare a multi-line yaml string. You can learn more about multi-line yaml syntax here

⚠️ Note for Windows: Both \ and / path separators are accepted in files globs. If you need to match a literal glob metacharacter such as [ or ], keep escaping the metacharacter itself in the pattern.

If your release assets are generated under a subdirectory, set working_directory and keep the files patterns relative to that directory.

yaml
- name: Release
  uses: softprops/action-gh-release@v3
  if: github.ref_type == 'tag'
  with:
    working_directory: dist
    files: |
      Release.txt
      checksums/*.txt

External release notes

Many systems exist that can help generate release notes for you. This action supports loading release notes from a path in your repository's build to allow for the flexibility of using any changelog generator for your releases, including a human ‍

…

When you use GitHub's built-in generate_release_notes support, you can optionally pin the comparison base explicitly with previous_tag. This is useful when the default comparison range does not match the release series you want to publish.

yaml
- name: Release
  uses: softprops/action-gh-release@v3
  with:
    tag_name: stage-2026-03-15
    target_commitish: ${{ github.sha }}
    previous_tag: prod-2026-03-01
    generate_release_notes: true

Customizing

inputs

The following are optional as step.with keys

Name Type Description
body String Text communicating notable changes in this release
body_path String Path to load text communicating notable changes in this release
draft Boolean Keep the release as a draft. Defaults to false. When reusing an existing draft release, set this to true to keep it draft; omit it to publish after upload.
prerelease Boolean Indicator of whether or not is a prerelease
preserve_order Boolean Upload assets sequentially in the provided order. This controls the action's upload behavior, but it does not control the final asset ordering that GitHub may display on the release page or return from the Releases API.
files String Newline-delimited globs of paths to assets to upload for release. Escape glob metacharacters when you need to match a literal filename that contains them, such as [ or ]. ~/... expands to the runner home directory. On Windows, both \ and / separators are accepted. GitHub may normalize raw asset filenames that contain special characters; the action restores the asset label when possible, but the final download name remains GitHub-controlled.
working_directory String Base directory to resolve files globs against. Use this when release assets live under a subdirectory. If omitted, the action resolves files from ${{ github.workspace }}.
overwrite_files Boolean Indicator of whether files should be overwritten when they already exist. Defaults to true
name String Name of the release. defaults to tag name
tag_name String Name of a tag. defaults to github.ref_name. refs/tags/<name> values are normalized to <name>.
fail_on_unmatched_files Boolean Indicator of whether to fail if any of the files globs match nothing
repository String Name of a target repository in <owner>/<repo> format. Defaults to GITHUB_REPOSITORY env variable
target_commitish String Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Defaults to repository default branch. When creating a new tag for an older commit, github.token may not have permission to create the ref; use a PAT or another token with sufficient contents permissions if you hit `403 Resource not accessible b

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptgithub-actionsgithub-releases

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具