2024-02-26 18:43:44 +00:00
|
|
|
#!/bin/bash
|
2024-02-23 21:06:26 +00:00
|
|
|
|
|
|
|
VERSION=$(cat VERSION)
|
|
|
|
echo "Grabbing Release Data From:" "https://git.openprivacy.ca/api/v1/repos/$DRONE_REPO/releases/tags/$VERSION"
|
|
|
|
RELEASEID=$(curl -s -X 'GET' "https://git.openprivacy.ca/api/v1/repos/$DRONE_REPO/releases/tags/$VERSION" -H 'accept: application/json' | jq '.id')
|
|
|
|
echo $RELEASEID
|
2024-02-24 04:36:14 +00:00
|
|
|
if [ "$RELEASEID" = "null" ]; then
|
|
|
|
# $var is empty
|
2024-02-26 18:04:52 +00:00
|
|
|
exit 0
|
2024-02-24 04:36:14 +00:00
|
|
|
fi
|
|
|
|
|
2024-02-23 21:06:26 +00:00
|
|
|
|
2024-02-26 22:41:43 +00:00
|
|
|
URL="https://git.openprivacy.ca/api/v1/repos/$DRONE_REPO/releases/$RELEASEID/assets?name=$3"
|
2024-02-23 21:06:26 +00:00
|
|
|
FILE="@$1"
|
|
|
|
RESULT=$(curl -o /dev/null -w "%{http_code}" -X POST -H "Authorization: token $GOGS_ACCOUNT_TOKEN" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "attachment=$FILE;type=$2" $URL)
|
|
|
|
|
|
|
|
|
|
|
|
if [ $RESULT -eq 201 ]
|
|
|
|
then
|
|
|
|
echo "Success posting to $URL"
|
|
|
|
else
|
|
|
|
echo "ERROR HTTP $RESULT posting to $URL"
|
2024-02-26 18:04:52 +00:00
|
|
|
exit 0
|
2024-02-23 21:06:26 +00:00
|
|
|
fi
|