feat(gitea,release): use multisort to bypass gitea created_at bug
This commit is contained in:
parent
abe8dd5f1b
commit
6ebceae3b9
@ -137,8 +137,7 @@ function json_set {
|
||||
}
|
||||
|
||||
function upload_release_attachments {
|
||||
local release="$1"
|
||||
local release_id=$(echo "$release" | jq -r .id)
|
||||
local release_id="$1"
|
||||
|
||||
if [ -z "$GITEA_RELEASE_ATTACHMENTS" ]; then
|
||||
set +e
|
||||
@ -175,7 +174,7 @@ function clean_prereleases {
|
||||
fi
|
||||
|
||||
local releases=$(gitea_api "/repos/$GITEA_RELEASE_ORG/$GITEA_RELEASE_PROJECT/releases")
|
||||
local to_delete=$(echo "$releases" | jq -r --arg index "$GITEA_RELEASE_CLEANUP_KEPT_PRERELEASES" '[.[] | select(.prerelease == true)] | sort_by(.created_at) | reverse | .[$index | tonumber:] | .[].id')
|
||||
local to_delete=$(echo "$releases" | jq -r --arg index "$GITEA_RELEASE_CLEANUP_KEPT_PRERELEASES" '[.[] | select(.prerelease == true)] | sort_by(.created_at, .id) | reverse | .[$index | tonumber:] | .[].id')
|
||||
|
||||
echo $to_delete
|
||||
|
||||
@ -194,8 +193,9 @@ function main {
|
||||
retrieve_commitish_target
|
||||
retrieve_version
|
||||
local release=$(create_release)
|
||||
local release_id=$(echo "$release" | jq -r .id)
|
||||
sleep 1 # Wait for release creation
|
||||
upload_release_attachments "$release"
|
||||
upload_release_attachments "$release_id"
|
||||
clean_prereleases
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user