Skip to content

Release Draft

Create or update a draft GitHub release from a release-drafter style config, a resolved version, and changelog content.

Usage

- name: Create draft release
  id: release_draft
  uses: athackst/ci/actions/release-draft@main
  with:
    token: ${{ github.token }}
    resolved-version: ${{ steps.version.outputs.resolved-version }}
    changelog: ${{ steps.changelog.outputs.changelog }}

Inputs

Name Description Default
token GitHub token used to draft the release. None
configuration-path (optional) Path to a release-drafter style config file. Bundled release-drafter.yml
changelog Changelog content interpolated into the release body template. None
resolved-version Version interpolated into the release name and tag templates. None
release-match-pattern (optional) Regex used to find an existing draft release to update by tag name. ^v[0-9]+(\.[0-9]+)*$
name (optional) Release name override. Rendered from config
tag-name (optional) Release tag name override. Rendered from config

Outputs

Name Description
id The release ID.
name The release name.
tag-name The release tag name.
html-url The HTML URL for the release.
upload-url The upload URL for release assets.

Permissions

  • Requires a token that can create and update releases. contents: write is typically sufficient.

Advanced

  • Uses the bundled release-drafter.yml when configuration-path is not set.
  • Supports name-template, tag-template, and template, plus template-file for loading the release body from a file.
  • Template interpolation supports $RESOLVED_VERSION, $VERSION, $CHANGES, and $CHANGELOG.
  • If exactly one draft release matches release-match-pattern, that draft is updated in place.
  • If multiple draft releases match release-match-pattern, the action fails rather than guessing.
  • If a non-draft release already exists for the resolved tag, the action fails instead of replacing it.

Examples

Use a repository-specific release config:

- name: Create draft release
  uses: athackst/ci/actions/release-draft@main
  with:
    token: ${{ secrets.CI_BOT_TOKEN }}
    configuration-path: .github/release-drafter.yml
    resolved-version: ${{ steps.version.outputs.resolved-version }}
    changelog: ${{ steps.changelog.outputs.changelog }}