Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
πŸ“¦ :octocat: GitHub Action for creating GitHub Releases
TypeScript Shell JavaScript
Use this GitHub Action with your project

Add this Action to an existing workflow or create a new one.

View on Marketplace
Branch: master
Clone or download
Latest commit 91409e7 Jan 27, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github try ncc for packaging (#37) Jan 5, 2020
__tests__ Add tag_name option (#39) Jan 9, 2020
dist rebuild index Jan 27, 2020
src Add tag_name option (#39) Jan 9, 2020
tests/data/foo extract, test and fix path selection to only include files Aug 25, 2019
.gitignore back to minimal set Oct 20, 2019
CHANGELOG.md consolidate Jan 27, 2020
CONTRIBUTING.md empathy for those new to typescript projects Sep 9, 2019
LICENSE lic Aug 25, 2019
README.md
action.yml Add tag_name option (#39) Jan 9, 2020
demo.png add demo screenshot Sep 11, 2019
jest.config.js refactor for cross platform use Sep 9, 2019
package-lock.json try ncc for packaging (#37) Jan 5, 2020
package.json Make "npm run fmt(check)" work on Windows (#41) Jan 12, 2020
release.sh Feat/upload (#34) Dec 28, 2019
tsconfig.json refactor for cross platform use Sep 9, 2019

README.md

πŸ“¦ :octocat:

action gh-release

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


🀸 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 resuse value of your workflow for non-tag pushes.

Below is a simple example of step.if tag gating

name: Main

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/')
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

You can also use push config tag filter

name: Main

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

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Release
        uses: softprops/action-gh-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

⬆️ Uploading release assets

You can 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.

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

name: Main

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Build
        run: echo ${{ github.sha }} > Release.txt
      - name: Test
        run: cat Release.txt
      - name: Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/')
        with:
          files: Release.txt
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

name: Main

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Build
        run: echo ${{ github.sha }} > Release.txt
      - name: Test
        run: cat Release.txt
      - name: Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/')
        with:
          files: |
            Release.txt
            LICENSE
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

πŸ“ 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 πŸ‘©β€πŸ’»

name: Main

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Generate Changelog
        run: echo "# Good things have arrived" > ${{ github.workflow }}-CHANGELOG.txt
      - name: Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/')
        with:
          body_path: ${{ github.workflow }}-CHANGELOG.txt
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

πŸ’… 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 Indicator of whether or not this release is a draft
prerelease Boolean Indicator of whether or not is a prerelease
files String Newline-delimited globs of paths to assets to upload for release
name String Name of the release. defaults to tag name
tag_name String Name of a tag. defaults to github.ref

πŸ’‘When providing a body and body_path at the same time, body_path will be attempted first, then falling back on body if the path can not be read from.

outputs

The following outputs can be accessed via ${{ steps.<step-id>.outputs }} from this action

Name Type Description
url String Github.com URL for the release

environment variables

The following are required as step.env keys

Name Description
GITHUB_TOKEN GITHUB_TOKEN as provided by secrets

⚠️ Note: This action was previously implemented as a docker container, limiting its use to GitHub Actions Linux virtual environments only. With recent releases, we now support cross platform usage. You'll need to remove the docker:// prefix in these versions

Doug Tangren (softprops) 2019

You can’t perform that action at this time.