Skip to content

Commit

Permalink
upload the zsync file
Browse files Browse the repository at this point in the history
Signed-off-by: Rahammetoela Toekiman <[email protected]>
  • Loading branch information
Fuseteam committed May 14, 2022
1 parent 8386403 commit 5e21675
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions admin/linux/upload-appimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ cd /build
# AppImage
export APPIMAGE=$(readlink -f ./Nextcloud*.AppImage)
export UPDATE=$(readlink -f ./Nextcloud*.AppImage.zsync)
export BASENAME=$(basename ${APPIMAGE})
export BASENAME_APPIMAGE=$(basename ${APPIMAGE})
export BASENAME_UPDATE=$(basename ${UPDATE})

if ! test -e $APPIMAGE ; then
exit 1
Expand Down Expand Up @@ -69,9 +70,10 @@ get_release_assets()

upload_release_asset()
{
uploadUrl=$1
echo $(curl --max-time 900 -u $GIT_USERNAME:$GIT_TOKEN -X POST $uploadUrl --header "Content-Type: application/octet-stream" --upload-file $APPIMAGE)
echo $(curl --max-time 900 -u $GIT_USERNAME:$GIT_TOKEN -X POST $uploadUrl --header "Content-Type: application/octet-stream" --upload-file $UPDATE)
uploadUrlAppImage=$1
uploadUrlUpdate=$2
echo $(curl --max-time 900 -u $GIT_USERNAME:$GIT_TOKEN -X POST $uploadUrlAppImage --header "Content-Type: application/octet-stream" --upload-file $APPIMAGE)
echo $(curl --max-time 900 -u $GIT_USERNAME:$GIT_TOKEN -X POST $uploadUrlUpdate --header "Content-Type: application/octet-stream" --upload-file $UPDATE)
}

delete_release_asset()
Expand Down Expand Up @@ -100,7 +102,8 @@ if [[ "$uploadUrl" == "null" ]]; then
fi

# Prepare upload url
uploadUrl=$(echo "${uploadUrl/'{?name,label}'/?name=$BASENAME}")
uploadUrlAppImage=$(echo "${uploadUrl/'{?name,label}'/?name=$BASENAME_APPIMAGE}")
uploadUrlUpdate=$(echo "${uploadUrl/'{?name,label}'/?name=$BASENAME_UPDATE}")

# Try to delete existing AppImage assets for this PR
assets=$(get_release_assets $releaseId)
Expand All @@ -120,7 +123,7 @@ done
# Upload release asset
echo "Uploading new asset: $BASENAME"

json=$(upload_release_asset "$uploadUrl")
json=$(upload_release_asset "$uploadUrlAppImage" "$uploadUrlUpdate")
browserDownloadUrl=$(echo $json | jq -r '.browser_download_url')

if [[ "$browserDownloadUrl" == "null" ]]; then
Expand Down

0 comments on commit 5e21675

Please sign in to comment.