-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a script to push to Maven Central (#35)
- Loading branch information
Showing
4 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
set -eou pipefail | ||
|
||
if [ -z "$1" ]; then | ||
echo "Usage: ./publish_release_to_maven_central.sh <github release>" | ||
exit 1 | ||
fi | ||
|
||
if [ -n "$(git status --porcelain)" ]; then | ||
echo "there are local changes, not building (check \"git status\")" | ||
exit 1 | ||
fi | ||
|
||
(gh release list --json tagName,isDraft,isPrerelease | jq -e ".[] | select(.tagName == \"$1\" and .isDraft == false and .isPrerelease == false)") || (echo "couldn't find release" && exit 1) | ||
git fetch --tags | ||
git checkout tags/"$1" | ||
git describe --exact-match --tags | ||
|
||
SIGNING_KEY_ID=$(op read "op://Private/Sonatype GPG/key id") \ | ||
SIGNING_KEY_PASSPHRASE=$(op read "op://Private/Sonatype GPG/password") \ | ||
./gradlew clean core:compileJava core:packageMavenCentralRelease | ||
|
||
MAVEN_CENTRAL_USER=$(op read "op://Private/New Maven Central Portal Publish/username") | ||
MAVEN_CENTRAL_TOKEN=$(op read "op://Private/New Maven Central Portal Publish/password") | ||
BEARER_TOKEN=$(echo "$MAVEN_CENTRAL_USER:$MAVEN_CENTRAL_TOKEN" | base64) | ||
|
||
curl --request POST \ | ||
--verbose \ | ||
--header "Authorization: Bearer $BEARER_TOKEN" \ | ||
--form bundle=@core/build/repos/release-"$VERSION".zip \ | ||
https://central.sonatype.com/api/v1/publisher/upload?name="$VERSION"\&publishingType=USER_MANAGED |