GitHub Action
gh-create-release
v5.0.1
Latest version
A GitHub action to automate the creation of releases.
Source code available at https://github.com/notpeelz/github-create-release
Parameter | Description | Default |
---|---|---|
token |
The GitHub access token. |
${{ github.token }} |
repository |
The repository where the release should be created. For example, octocat/hello-world |
${{ github.repository }} |
target |
The git object to tag. This can be a SHA or a ref to a git object. |
|
tag 1 |
The name of the tag associated with the release. |
|
tag-message |
The message associated with the tag (defaults to the name of the tag) |
|
strategy |
Determines what should be done if the tag already exists. Possible values: fail-fast - aborts with an error if the tag already existsuse-existing-tag - uses an existing tag, replacing associated releases (target parameter is ignored)replace - replaces the tag along with associated releases |
fail-fast |
title |
The title of the release. |
|
title-source |
Determines where the the title should be read from. Possible values: literal - uses the "title" parameter as-isfile - reads from the file specified in the "title" parameterenv - reads from the environment variable specified in the "title" parameter |
literal |
body |
The message associated with the release. |
|
body-source |
Determines where the the body should be read from. Possible values: literal - uses the "body" parameter as-isfile - reads from the file specified in the "body" parameterenv - reads from the environment variable specified in the "body" parameter |
literal |
prerelease |
If true, the release will be marked as a pre-release. |
|
draft |
If true, the release will be made into a draft. | |
discussion-category-name |
If specified, a discussion of the specified category is created and linked to the release. |
|
files |
Newline-separated list of files to upload (supports globbing). Missing files are ignored. |
Parameter | Description |
---|---|
release-id |
The unique identifier of the release that was created. See https://docs.github.com/en/rest/releases/releases#get-a-release |
name: Publish release
on:
push:
tags:
- "*"
jobs:
publish-release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Build
run: |
echo "stuff!" > file1.txt
echo "more stuff!" > file2.txt
echo "even more stuff!" > even_more_stuff.txt
echo "even more stuff! (#2)" > even_more_stuff_v2.txt
- uses: notpeelz/action-gh-create-release@v5.0.1
with:
strategy: existing
tag: ${{ github.ref_name }}
title: ${{ github.ref_name }}
files: |
file*.txt
even_more_stuff{,_v2}.txt
name: Create release
on:
workflow_dispatch:
inputs:
version:
description: "Version"
required: true
type: string
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
- uses: notpeelz/action-gh-create-release@v5.0.1
with:
strategy: fail-fast # this is the default
# TODO: it's probably a good idea to validate the version format
# in an earlier step.
tag: v${{ inputs.version }}
title: v${{ inputs.version }}
Footnotes
-
required ↩