From daebd789f98501af98b39334a374707537e67008 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Thu, 1 Feb 2024 22:15:47 +0100 Subject: [PATCH] add scripts dir for publishing --- scripts/publish.sh | 11 +++++++++++ scripts/release.sh | 24 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 scripts/publish.sh create mode 100755 scripts/release.sh diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100755 index 0000000..4a3d17d --- /dev/null +++ b/scripts/publish.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e +cargo check --all-features +echo ">>>>>>>> PUBLISHING RELEASE FOR REPO" +bash scripts/release.sh +echo ">>>>>>>> PUBLISHING TO CRATES.IO NEXT" +sleep 2 +cargo publish +echo ">>>>>>>> PUBLISHING TO CSCHERR.DE NEXT" +sleep 2 +cargo publish --registry cscherr diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..943ad51 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,24 @@ +#!/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') +GIT_COMMIT_SHA=$(git rev-parse HEAD) +REPO=${PWD##*/} # name of cwd +BODY=" +$(git log $(git describe --tags --abbrev=0)..HEAD --pretty="- %s" --oneline --decorate) +" +USER=PlexSheep +git tag "v$NEW_VERSION-test" || echo "could not tag" +curl -X 'POST' \ + 'https://git.cscherr.de/api/v1/repos/PlexSheep/'$REPO'/releases' \ + -H 'accept: application/json' \ + -H "Authorization: token $TOKEN" \ + -H 'Content-Type: application/json' \ + -d '{ + "body": "'"$BODY"'", + "draft": false, + "name": "v'$NEW_VERSION'", + "prerelease": true, + "tag_name": "v'$NEW_VERSION'", + "target_commitish": "'$GIT_COMMIT_SHA'" +}' | python -m json.tool +git push || echo "could not push"