mirror of
https://code.forgejo.org/actions/forgejo-release
synced 2026-02-19 04:57:01 +00:00
fix: wrong assest upload
This commit is contained in:
parent
9112f0a8e8
commit
0fe1533e48
2 changed files with 16 additions and 33 deletions
|
|
@ -12,8 +12,6 @@ if ${VERBOSE:-false}; then set -x; fi
|
||||||
: ${DOWNLOAD_LATEST:=false}
|
: ${DOWNLOAD_LATEST:=false}
|
||||||
: ${TMP_DIR:=$(mktemp -d)}
|
: ${TMP_DIR:=$(mktemp -d)}
|
||||||
: ${GNUPGHOME:=$TMP_DIR}
|
: ${GNUPGHOME:=$TMP_DIR}
|
||||||
: ${TEA_BIN:=$TMP_DIR/tea}
|
|
||||||
: ${TEA_VERSION:=0.10.1}
|
|
||||||
: ${OVERRIDE:=false}
|
: ${OVERRIDE:=false}
|
||||||
: ${HIDE_ARCHIVE_LINK:=false}
|
: ${HIDE_ARCHIVE_LINK:=false}
|
||||||
: ${RETRY:=1}
|
: ${RETRY:=1}
|
||||||
|
|
@ -27,16 +25,6 @@ TAG_URL=$(echo "$TAG" | sed 's/\//%2F/g')
|
||||||
|
|
||||||
export GNUPGHOME
|
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() {
|
get_tag() {
|
||||||
if ! test -f "$TAG_FILE"; then
|
if ! test -f "$TAG_FILE"; then
|
||||||
if api GET repos/$REPO/tags/"$TAG_URL" >"$TAG_FILE"; then
|
if api GET repos/$REPO/tags/"$TAG_URL" >"$TAG_FILE"; then
|
||||||
|
|
@ -81,15 +69,6 @@ delete_tag() {
|
||||||
}
|
}
|
||||||
|
|
||||||
upload_release() {
|
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
|
if $PRERELEASE || echo "${TAG}" | grep -qi '\-rc'; then
|
||||||
prerelease="true"
|
prerelease="true"
|
||||||
echo "Uploading as Pre-Release"
|
echo "Uploading as Pre-Release"
|
||||||
|
|
@ -110,22 +89,12 @@ upload_release() {
|
||||||
exit 22
|
exit 22
|
||||||
fi
|
fi
|
||||||
if [ "$SKIP_ASSETS" == 'false' ]; then
|
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
|
for file in "$RELEASE_DIR"/*; do
|
||||||
local name=$(basename $file)
|
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
|
done
|
||||||
fi
|
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
|
maybe_use_release_note_assistant
|
||||||
release_draft false
|
release_draft false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
testdata/forgejo-release-test.sh
vendored
14
testdata/forgejo-release-test.sh
vendored
|
|
@ -4,6 +4,20 @@
|
||||||
set -ex
|
set -ex
|
||||||
PS4='${BASH_SOURCE[0]}:$LINENO: ${FUNCNAME[0]}: '
|
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() {
|
test_system_tea_bin() {
|
||||||
SYSTEM_TEA_BIN=$TMP_DIR/tea
|
SYSTEM_TEA_BIN=$TMP_DIR/tea
|
||||||
touch $SYSTEM_TEA_BIN && chmod +x $SYSTEM_TEA_BIN
|
touch $SYSTEM_TEA_BIN && chmod +x $SYSTEM_TEA_BIN
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue