Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
file-text

GitHub Action

Draft Release Notes

v0.1.1

Draft Release Notes

file-text

Draft Release Notes

Create a draft release on GitHub based on release.yml

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Draft Release Notes

uses: lucacome/[email protected]

Learn more about this action in lucacome/draft-release

Choose a version

Draft Release Action

This action creates a draft release for the next version to be released. It reads the release file in .github/release.yml and creates a draft release with the next version number based on the current version number and the labels of the pull requests merged since the last release.

To use this action, you need to create a release file in .github/release.yml as shown in the GitHub documentation for creating a release file.

To decide whether the next release should be a major or minor release, the action looks at the labels of the pull requests merged since the last release. If there is at least one pull request with the label specified in the major-label input, the next release will be a major release. Otherwise, if there is at least one pull request with the label specified in the minor-label input, the next release will be a minor release. Otherwise, the next release will be a patch release.

Simple Usage

name: Draft Release

on:
  push:
    branches:
      - main

jobs:
  draft-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: lucacome/[email protected]
        with:
          minor-label: 'enhancement'
          major-label: 'change'

Inputs

Name Type Description
minor-label string The label to use for minor releases. (default enhancement)
major-label string The label to use for major releases. (default change)
notes-header string The header to use for the release notes.
notes-footer string The footer to use for the release notes.
github-token string The GitHub token to use for the release. (default github.token)

Outputs

Name Type Description
version string The version number of the next release.
release-id string The ID of the next release.
release-notes string The release notes of the next release.
release-url string The URL of the next release.

Header and Footer

The header and footer have two special placeholders that will be replaced with the version number of the next release:

  • {{version}} will be replaced with the version number of the next release.
  • {{version-number}} will be replaced with the version number of the next release without the v prefix.

Examples

Add Footer

name: Draft Release

on:
  push:
    branches:
      - main

jobs:
  draft-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: lucacome/[email protected]
        with:
          minor-label: 'enhancement'
          major-label: 'change'
          notes-footer: |
            This is a footer.
            It can be multiline.

Get Version Number of Next Release

name: Draft Release

on:
  push:
    branches:
      - main

jobs:
  draft-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: lucacome/[email protected]
        id: draft-release
        with:
          minor-label: 'enhancement'
          major-label: 'change'

      - name: Get Version Number
        run: echo ${{ steps.draft-release.outputs.version }}