9
0
Fork 0
mirror of https://code.forgejo.org/actions/forgejo-release synced 2026-02-18 04:27:01 +00:00

fix: wrong assest upload

This commit is contained in:
Michael Kriese 2026-02-17 17:35:27 +01:00
parent 9112f0a8e8
commit 0fe1533e48
No known key found for this signature in database
GPG key ID: F8D7748549A5986A
2 changed files with 16 additions and 33 deletions

View file

@ -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
}

View file

@ -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