This repository has been archived on 2024-10-16. You can view files and clone it, but cannot push or open issues or pull requests.
pt/scripts/release.sh

25 lines
824 B
Bash
Raw Normal View History

2024-01-18 17:49:44 +01:00
#!/bin/bash
TOKEN=$(cat ~/.git-credentials | grep 'git.cscherr.de' | grep -P '(?:)[^:]*(?=@)' -o)
NEW_VERSION=$(cat Cargo.toml | rg '^\s*version\s*=\s*"([^"]*)"\s*$' -or '$1')
VERSION=$(git rev-parse HEAD)
GIT_COMMIT_SHA=$(git rev-parse HEAD)
BODY="
2024-01-23 14:03:57 +01:00
$(git log $(git describe --tags --abbrev=0)..HEAD --pretty="- %s" --oneline --decorate)
2024-01-18 17:49:44 +01:00
"
USER=PlexSheep
2024-02-02 00:06:56 +01:00
git tag "v$NEW_VERSION" || echo "could not tag"
2024-01-18 17:49:44 +01:00
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"'",
2024-01-18 22:02:06 +01:00
"draft": false,
"name": "v'$NEW_VERSION'",
2024-01-18 17:49:44 +01:00
"prerelease": true,
"tag_name": "v'$NEW_VERSION'",
"target_commitish": "'$GIT_COMMIT_SHA'"
}' | python -m json.tool
git push || echo "could not push"