From 5874c2b28eaae246a46a7608857e0debf646ed97 Mon Sep 17 00:00:00 2001 From: Bengt Martensson Date: Tue, 19 Mar 2024 14:39:21 +0100 Subject: [PATCH] Fix upload.sh for the case tag ci-build non-existing. --- common/scripts/upload.sh | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/common/scripts/upload.sh b/common/scripts/upload.sh index a669fd13..c8582b0a 100755 --- a/common/scripts/upload.sh +++ b/common/scripts/upload.sh @@ -106,37 +106,38 @@ if [ "$TRAVIS_COMMIT" != "$tag_sha" ] ; then curl -XDELETE \ --header "Authorization: token ${GITHUB_TOKEN}" \ "${delete_url}" +fi # if [ "$TRAVIS_COMMIT" != "$tag_sha" ] - echo "Create release..." +echo "Create release..." - if [ -z "$TRAVIS_BRANCH" ] ; then - TRAVIS_BRANCH="master" - fi +if [ -z "$TRAVIS_BRANCH" ] ; then + TRAVIS_BRANCH="master" +fi # if [ ! -z "$TRAVIS_JOB_ID" ] ; then # BODY="Travis CI build log: https://travis-ci.org/$REPO_SLUG/builds/$TRAVIS_BUILD_ID/" # else # BODY="" # fi - BODY="WARNING: This is a snapshot of the current development stand. " - BODY+="It may have different issues, and possibly does not work at all. " - BODY+="If this is not what you want, use the latest official release instead." +BODY="WARNING: This is a snapshot of the current development stand. " +BODY+="It may have different issues, and possibly does not work at all. " +BODY+="If this is not what you want, use the latest official release instead." # BODY=$(<${DIR}/ci-build-body.md) - release_infos=$(curl -H "Authorization: token ${GITHUB_TOKEN}" \ +release_infos=$(curl -H "Authorization: token ${GITHUB_TOKEN}" \ --data '{"tag_name": "'"$RELEASE_NAME"'","target_commitish": "'"$TRAVIS_BRANCH"'","name": "'"Continuous build"'","body": "'"$BODY"'","draft": false,"prerelease": true}' "https://api.github.com/repos/$REPO_SLUG/releases") - echo "$release_infos" +echo "$release_infos" - unset upload_url - upload_url=$(echo "$release_infos" | grep '"upload_url":' | head -n 1 | cut -d '"' -f 4 | cut -d '{' -f 1) - echo "upload_url: $upload_url" +unset upload_url +upload_url=$(echo "$release_infos" | grep '"upload_url":' | head -n 1 | cut -d '"' -f 4 | cut -d '{' -f 1) +echo "upload_url: $upload_url" - unset release_url - release_url=$(echo "$release_infos" | grep '"url":' | head -n 1 | cut -d '"' -f 4 | cut -d '{' -f 1) - echo "release_url: $release_url" +unset release_url +release_url=$(echo "$release_infos" | grep '"url":' | head -n 1 | cut -d '"' -f 4 | cut -d '{' -f 1) +echo "release_url: $release_url" -fi # if [ "$TRAVIS_COMMIT" != "$tag_sha" ] +##fi # if [ "$TRAVIS_COMMIT" != "$tag_sha" ] echo "Upload binaries to the release..."