Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
crueter 2025-11-14 22:45:34 -05:00
parent d5e77e0b90
commit 3dd816beaa
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6

View file

@ -1,6 +1,7 @@
#!/bin/sh -e
#!/bin/sh
# SPDX-License-Identifier: MIT
# calling this directly via e.g. bash forgejo-release.sh will not set -e if it's in the shebang only
set -e
if ${VERBOSE:-false}; then set -x; fi
@ -81,10 +82,11 @@ delete_tag() {
upload_release() {
# assets is defined as a list of arguments, where values may contain whitespace and need to be quoted like this -a "my file.txt" -a "file.txt".
# It is expanded using "${assets[@]}" which preserves the separation of arguments and not split whitespace containing values.
# For reference, see https://github.com/koalaman/shellcheck/wiki/SC2086#exceptions
# It is built using "set --" and expanded with "$@", which preserves argument separation and whitespace splitting.
# For reference, see https://www.shellcheck.net/wiki/SC3030
# In this case, we do not need more than one array, so set -- is fine here.
for file in "$RELEASE_DIR"/*; do
assets="$assets -a $file"
set -- "$@" -a "$file"
done
if $PRERELEASE || echo "${TAG}" | grep -qi '\-rc'; then
@ -97,11 +99,11 @@ upload_release() {
ensure_tag
# shellcheck disable=SC2086
if ! $TEA_BIN release create $assets --repo "$REPO" --note "$RELEASENOTES" --tag "$TAG" --title "$TITLE" --draft "$releaseType" > "$TMP_DIR"/tea.log 2>&1; then
if ! $TEA_BIN release create "$@" --repo "$REPO" --note "$RELEASENOTES" --tag "$TAG" --title "$TITLE" --draft "$releaseType" > "$TMP_DIR"/tea.log 2>&1; 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
$TEA_BIN release create $assets --repo "$REPO" --note "$RELEASENOTES" --tag "$TAG" --title "$TITLE" --draft "$releaseType"
$TEA_BIN release create "$@" --repo "$REPO" --note "$RELEASENOTES" --tag "$TAG" --title "$TITLE" --draft "$releaseType"
else
cat "$TMP_DIR"/tea.log
return 1