From 0fe1533e485e39137278f57ab0b300bb995e6aa7 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 17 Feb 2026 17:35:27 +0100 Subject: [PATCH] fix: wrong assest upload --- forgejo-release.sh | 35 ++------------------------------ testdata/forgejo-release-test.sh | 14 +++++++++++++ 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/forgejo-release.sh b/forgejo-release.sh index 38a1b04..78ccca4 100755 --- a/forgejo-release.sh +++ b/forgejo-release.sh @@ -12,8 +12,6 @@ if ${VERBOSE:-false}; then set -x; fi : ${DOWNLOAD_LATEST:=false} : ${TMP_DIR:=$(mktemp -d)} : ${GNUPGHOME:=$TMP_DIR} -: ${TEA_BIN:=$TMP_DIR/tea} -: ${TEA_VERSION:=0.10.1} : ${OVERRIDE:=false} : ${HIDE_ARCHIVE_LINK:=false} : ${RETRY:=1} @@ -27,16 +25,6 @@ TAG_URL=$(echo "$TAG" | sed 's/\//%2F/g') export GNUPGHOME -setup_tea() { - if which tea 2>/dev/null; then - TEA_BIN=$(which tea) - elif ! test -f $TEA_BIN; then - ARCH=$(dpkg --print-architecture) - curl -sL https://dl.gitea.io/tea/$TEA_VERSION/tea-$TEA_VERSION-linux-"$ARCH" >$TEA_BIN - chmod +x $TEA_BIN - fi -} - get_tag() { if ! test -f "$TAG_FILE"; then if api GET repos/$REPO/tags/"$TAG_URL" >"$TAG_FILE"; then @@ -81,15 +69,6 @@ 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 - local assets=() - if [ "$SKIP_ASSETS" == 'false' ]; then - for file in "$RELEASE_DIR"/*; do - assets=("${assets[@]}" -a "$file") - done - fi if $PRERELEASE || echo "${TAG}" | grep -qi '\-rc'; then prerelease="true" echo "Uploading as Pre-Release" @@ -110,22 +89,12 @@ upload_release() { exit 22 fi if [ "$SKIP_ASSETS" == 'false' ]; then - local id=$(jq --raw-output .id <"$TMP_DIR"/release.json) + release_id=$(jq --raw-output .id <"$TMP_DIR"/release.json) for file in "$RELEASE_DIR"/*; do local name=$(basename $file) - api_bin repos/$REPO/releases/$id/assets/$name -D @$file + api_bin repos/$REPO/releases/$release_id/assets/$name -D @$file done fi - # if ! $TEA_BIN 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 - # $TEA_BIN release create "${assets[@]}" --repo $REPO --note "$RELEASENOTES" --tag "$TAG" --title "$TITLE" --draft ${releaseType} - # else - # cat "$TMP_DIR"/tea.log - # return 1 - # fi - # fi maybe_use_release_note_assistant release_draft false } diff --git a/testdata/forgejo-release-test.sh b/testdata/forgejo-release-test.sh index 7fe332b..c00d45e 100755 --- a/testdata/forgejo-release-test.sh +++ b/testdata/forgejo-release-test.sh @@ -4,6 +4,20 @@ set -ex PS4='${BASH_SOURCE[0]}:$LINENO: ${FUNCNAME[0]}: ' +: ${TEA_BIN:=$TMP_DIR/tea} +: ${TEA_VERSION:=0.10.1} + +# TODO: remove, still used in some tests +setup_tea() { + if which tea 2>/dev/null; then + TEA_BIN=$(which tea) + elif ! test -f $TEA_BIN; then + ARCH=$(dpkg --print-architecture) + curl -sL https://dl.gitea.io/tea/$TEA_VERSION/tea-$TEA_VERSION-linux-"$ARCH" >$TEA_BIN + chmod +x $TEA_BIN + fi +} + test_system_tea_bin() { SYSTEM_TEA_BIN=$TMP_DIR/tea touch $SYSTEM_TEA_BIN && chmod +x $SYSTEM_TEA_BIN