#!/bin/bash TOKEN=$(cat ~/.git-credentials | grep -P '(?:)[^:]*(?=@)' -os | head -2 | tail -1) NEW_VERSION=$(cat Cargo.toml | rg '^\s*version\s*=\s*"([^"]*)"\s*$' -or '$1') VERSION=$(git rev-parse HEAD) BODY=$2 git tag "v$NEW_VERSION" || echo "could not tag" echo '$' "curl -X 'POST' 'https://git.cscherr.de/api/v1/repos/PlexSheep/pt/releases' -H 'accept: application/json' -H 'Authorization: token (redacted)' -H 'Content-Type: application/json' -d" '{ "body": "'$BODY'", "draft": true, "name": "v'$NEW_VERSION'", "prerelease": true, "tag_name": "v'$NEW_VERSION'", "target_commitish": "'$COMMIT_SHA'" }' curl -X 'POST' \ 'https://git.cscherr.de/api/v1/repos/PlexSheep/pt/releases' \ -H 'accept: application/json' \ -H "Authorization: token $TOKEN" \ -H 'Content-Type: application/json' \ -d '{ "body": "'$BODY'", "draft": true, "name": "v'$NEW_VERSION'", "prerelease": true, "tag_name": "v'$NEW_VERSION'", "target_commitish": "'$COMMIT_SHA'" }'