Compare commits

..

No commits in common. "be784c37efdddec796e42b4ea512b07742f9c2f3" and "720b7f3e543b3e84da76b8bc62ae2a331ed89c47" have entirely different histories.

1 changed files with 18 additions and 2 deletions

20
lib
View File

@ -21,6 +21,22 @@ function create-commit(){
} }
function create-release(){ function create-release(){
if [[ -z "${TAG}" ]]; then
echo "TAG key is not set"
exit
fi
if [[ $1 == 'latest' ]]; then
echo "Deleting old latest release"
RELEASE_LIST=$(curl -X GET -Url https://gitea.kdiva.ru/api/v1/repos/modules/sc-items/releases)
LATEST_RELEASE_ID=$(jq -r '.[] | select(.tag_name=="latest") | .id' <<< $RELEASE_LIST)
delete-release $LATEST_RELEASE_ID
delete-tag
RELEASE_TAG="$1"
else
RELEASE_TAG="$1-$DRONE_BRANCH"
fi
COMMIT_SHA=$(git rev-parse HEAD) COMMIT_SHA=$(git rev-parse HEAD)
RESPONSE=$(curl \ RESPONSE=$(curl \
-X 'POST' \ -X 'POST' \
@ -30,9 +46,9 @@ function create-release(){
-H 'Authorization: Bearer 10e4af53e553aacb905766512e36487492d61a66' \ -H 'Authorization: Bearer 10e4af53e553aacb905766512e36487492d61a66' \
-d '{ -d '{
"draft": false, "draft": false,
"name": "'"release $RELEASE"'", "name": "'"release $RELEASE_TAG"'",
"prerelease": false, "prerelease": false,
"tag_name": "'"$RELEASE"'", "tag_name": "'"$RELEASE_TAG"'",
"target_commitish": "'"$COMMIT_SHA"'" "target_commitish": "'"$COMMIT_SHA"'"
}') }')
} }