From b0876c539dc0d2492a0965ffd505271a3919116c Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Sat, 27 Jul 2024 14:06:55 +0200 Subject: [PATCH] Add ability to set the release title This PR allows you the set/override the release title, which was set to the tag and still defaults to the tag. --- action.yml | 4 ++++ forgejo-release.sh | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 3a640ea..07e73d5 100644 --- a/action.yml +++ b/action.yml @@ -10,6 +10,8 @@ inputs: description: 'owner/project relative to the URL' tag: description: 'Tag of the release' + title: + description: 'Title of the release (defaults to tag)' sha: description: 'SHA of the release' token: @@ -69,6 +71,8 @@ runs: TAG=${TAG##refs/tags/} fi + export TITLE="${{ inputs.title }}" + export DOWNLOAD_LATEST="${{ inputs.download-latest }}" export PRERELEASE="${{ inputs.prerelease }}" diff --git a/forgejo-release.sh b/forgejo-release.sh index c9dae1c..be7de5a 100755 --- a/forgejo-release.sh +++ b/forgejo-release.sh @@ -7,6 +7,7 @@ if ${VERBOSE:-false}; then set -x; fi : ${FORGEJO:=https://codeberg.org} : ${REPO:=forgejo-integration/forgejo} +: ${TITLE:=$TAG} : ${RELEASE_DIR:=dist/release} : ${DOWNLOAD_LATEST:=false} : ${TMP_DIR:=$(mktemp -d)} @@ -47,11 +48,11 @@ upload_release() { test ${releasetype+false} || echo "Uploading as Stable" ensure_tag anchor=$(echo $TAG | sed -e 's/^v//' -e 's/[^a-zA-Z0-9]/-/g') - if ! $BIN_DIR/tea release create $assets --repo $REPO --note "$RELEASENOTES" --tag $TAG --title $TAG --draft ${releasetype} >& $TMP_DIR/tea.log ; then + if ! $BIN_DIR/tea release create $assets --repo $REPO --note "$RELEASENOTES" --tag $TAG --title "$TITLE" --draft ${releasetype} >& $TMP_DIR/tea.log ; then if grep --quiet 'Unknown API Error: 500' $TMP_DIR/tea.log && grep --quiet services/release/release.go:194 $TMP_DIR/tea.log ; then echo "workaround v1.20 race condition https://codeberg.org/forgejo/forgejo/issues/1370" sleep 10 - $BIN_DIR/tea release create $assets --repo $REPO --note "$RELEASENOTES" --tag $TAG --title $TAG --draft ${releasetype} + $BIN_DIR/tea release create $assets --repo $REPO --note "$RELEASENOTES" --tag $TAG --title "$TITLE" --draft ${releasetype} else cat $TMP_DIR/tea.log return 1