From 9186c9ccadf945830e1de63141101a4351c5f139 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Mon, 18 Nov 2024 13:14:34 -0600 Subject: [PATCH] Allow optional configuration of the GitHub release announcement body --- github-release.sh | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/github-release.sh b/github-release.sh index d1b892f..bb3961b 100755 --- a/github-release.sh +++ b/github-release.sh @@ -1,6 +1,5 @@ #!/usr/bin/env -S bash -e - function usage() { echo "Usage:" echo @@ -13,8 +12,11 @@ function usage() { echo echo " -h Show this help and exit." echo " -d Dry run; do not push, deploy or publish anything." + echo " --notes=file Specifies an optional file which contains 'release notes' to include in the release announcement" } +function needs_arg() { if [ -z "$OPTARG" ]; then die "No arg for --$opt option"; fi; } + #-------------------------------------------- # Option parsing @@ -23,7 +25,17 @@ function exec_or_dry_run() { } PUSH_CHANGES=true -while getopts 'dhb:' opt; do +notesFile="" +while getopts 'dhb:-:' opt; do + if [ "$opt" = "-" ]; then + # long option: reformulate opt and OPTARG + # - extract long option name + opt="${OPTARG%%=*}" + # - extract long option argument (may be empty) + OPTARG="${OPTARG#"$opt"}" + # - remove assigning `=` + OPTARG="${OPTARG#=}" + fi case "$opt" in h) usage @@ -37,6 +49,11 @@ while getopts 'dhb:' opt; do echo "DRY RUN; would have executed:" "${@}" } ;; + notes) + needs_arg + notesFile="$OPTARG" + echo "Using external notes-file : $notesFile" + ;; \?) usage exit 1 @@ -110,16 +127,24 @@ introGuideUrl="${docsUrl}/introduction/html_single/Hibernate_Introduction.html" userGuideUrl="${docsUrl}/userguide/html_single/Hibernate_User_Guide.html" releaseName="Hibernate ${PROJECT_NAME} ${RELEASE_VERSION}" + +notesContent="" +if [ -f $notesFile ]; then + notesContent=$(cat "$notesFile") +else + notesContent="This release introduces a few minor improvements as well as bug fixes." +fi + releaseBody="""\ # Hibernate ${PROJECT_NAME} ${RELEASE_VERSION} released -Today, we published a new maintenance release of Hibernate ${PROJECT_NAME} ${RELEASE_VERSION_FAMILY}: ${RELEASE_VERSION}. +Today, we published a new release of Hibernate ${PROJECT_NAME} ${RELEASE_VERSION_FAMILY}: ${RELEASE_VERSION}. -## What's new +You can find the full list of ${RELEASE_VERSION} changes [here](https://hibernate.atlassian.net/issues/?jql=project%20%3D%20${JIRA_KEY}%20AND%20fixVersion%20%3D%20${TAG_NAME}). -This release introduces a few minor improvements as well as bug fixes. +## What's new -You can find the full list of ${RELEASE_VERSION} changes [here](https://hibernate.atlassian.net/issues/?jql=project%20%3D%20${JIRA_KEY}%20AND%20fixVersion%20%3D%20${TAG_NAME}). +${notesContent} ## Conclusion