Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

71 Commits

Repository files navigation

Release-GHRepository

Automatically creates releases based on pull requests and labels.

Specifications and practices

Release-GHRepository follows:

How it works

The workflow will trigger on pull requests to the main branch.

The following labels will inform the action what kind of release to create:

  • For a major release, and increasing the first number in the version use:
    • major
    • breaking
  • For a minor release, and increasing the second number in the version.
    • minor
    • feature
  • For a patch release, and increases the third number in the version.
    • patch
    • fix

When a pull request is closed, the action will create a release based on the labels and clean up any previous prereleases that were created.

Note

The labels can be configured using the MajorLabels, MinorLabels and PatchLabels parameters/settings in the configuration file to trigger on other labels.

This action is built on GitHub-Script which by default uses the GITHUB_TOKEN.

Usage

The action can be configured using the following settings:

NameDescriptionDefaultRequired
AutoCleanupControl whether to automatically cleanup prereleases. If disabled, the action will not remove any prereleases.truefalse
AutoPatchingControl whether to automatically handle patches. If disabled, the action will only create a patch release if the pull request has a 'patch' label.truefalse
ConfigurationFileThe path to the configuration file. Settings in the configuration file take precedence over the action inputs..github\auto-release.ymlfalse
CreateMajorTagControl whether to create a tag for major releases.truefalse
CreateMinorTagControl whether to create a tag for minor releases.truefalse
DatePrereleaseFormatThe format to use for the prerelease number using .NET DateTime format strings.''false
IgnoreLabelsA comma separated list of labels that do not trigger a release.NoReleasefalse
IncrementalPrereleaseControl whether to automatically increment the prerelease number. If disabled, the action will ensure only one prerelease exists for a given branch.truefalse
MajorLabelsA comma separated list of labels that trigger a major release.major, breakingfalse
MinorLabelsA comma separated list of labels that trigger a minor release.minor, featurefalse
PatchLabelsA comma separated list of labels that trigger a patch release.patch, fixfalse
UsePRTitleAsReleaseNameWhen enabled, uses the pull request title as the name for the GitHub release.falsefalse
UsePRBodyAsReleaseNotesWhen enabled, uses the pull request body as the release notes for the GitHub release.truefalse
UsePRTitleAsNotesHeadingWhen enabled, the release notes will begin with the pull request title as a H1 heading followed by the pull request body. The title will include a reference to the PR number.truefalse
VersionPrefixThe prefix to use for the version number.vfalse
WhatIfControl whether to simulate the action. If enabled, the action will not create any releases. Used for testing.falsefalse
DebugEnable debug output.'false'false
VerboseEnable verbose output.'false'false
VersionSpecifies the version of the GitHub module to install. Accepts an exact version or a NuGet version range (for example [1.2.0, 2.0.0)).false
PrereleaseAllow prerelease versions if available.'false'false
WorkingDirectoryThe working directory where the script runs.${{ github.workspace }}false

Configuration file

The configuration file is a YAML file that can be used to configure the action. By default, the configuration file is expected at .github\auto-release.yml, which can be changed using the ConfigurationFile setting. The action's configuration can be changed by altering the settings in the configuration file.

DatePrereleaseFormat: 'yyyyMMddHHmm'IncrementalPrerelease: falseVersionPrefix: ''

This example uses the date format for the prerelease, disables the incremental prerelease and removes the version prefix.

Example

Add a workflow in your repository using the following example:

name: Release-GHRepositoryon:
pull_request_target:
branches:
- maintypes:
- closed
- opened
- reopened
- synchronize
- labeledconcurrency:
group: ${{ github.workflow }}-${{ github.ref }}jobs:
Release-GHRepository:
runs-on: ubuntu-lateststeps:
- name: Checkout Codeuses: actions/checkout@v4
- name: Release-GHRepositoryuses: PSModule/Release-GHRepository@v1

Permissions

If running the action in a restrictive mode, the following permissions needs to be granted to the action:

permissions:
contents: write # Required to create releasespull-requests: write # Required to create comments on the PRs

About

Automatically creates releases based on pull requests and labels.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages