diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index 2bd2bf2..e49d1cd 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -39,6 +39,13 @@ on: description: Create the GitHub release of the tag (generated notes) after the tag. type: boolean default: false + release-notes: + description: >- + With github-release: the Markdown file that is the release's text, `{version}` standing for + the version without the tag prefix (e.g. release-notes/{version}.md); the file must exist. + Empty = notes generated from the merged pull requests. + type: string + default: "" harness-ref: description: Ref of IronFlock/workflows the harness scripts are taken from. type: string @@ -135,9 +142,18 @@ jobs: GH_TOKEN: ${{ steps.app.outputs.token }} REPO: ${{ github.repository }} TAG: ${{ steps.version.outputs.tag }} + TAG_PREFIX: ${{ inputs.tag-prefix }} + NOTES: ${{ inputs.release-notes }} run: | if gh release view "$TAG" --repo "$REPO" >/dev/null 2>&1; then echo "the GitHub release $TAG exists" + elif [ -n "$NOTES" ]; then + notes=${NOTES//"{version}"/${TAG#"$TAG_PREFIX"}} + if [ ! -f "$notes" ]; then + echo "::error::$TAG has no release notes: $notes is missing" + exit 1 + fi + gh release create "$TAG" --repo "$REPO" --verify-tag --title "$TAG" --notes-file "$notes" else gh release create "$TAG" --repo "$REPO" --verify-tag --title "$TAG" --generate-notes fi diff --git a/README.md b/README.md index efb566c..688f68e 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,10 @@ released commit (never a force push), for a hosting service that deploys from a branch: only release merges reach it. Protect that branch with a ruleset whose only bypass actor is the release App. With `github-release: true` it also creates the GitHub release of the tag -(generated notes), with the same token, so callers need no write rights. Both +(generated notes), with the same token, so callers need no write rights. +`release-notes` names a Markdown file in the repository to use as the +release's text instead (`{version}` stands for the version, e.g. +`release-notes/{version}.md`); the step fails when that file is missing. Both steps catch up on a re-run that finds the tag already set. ## Pull requests from a laptop