-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·50 lines (40 loc) · 2.25 KB
/
release.sh
File metadata and controls
executable file
·50 lines (40 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
set -e
SCRIPT_DIR=$(dirname $0)
USER_JRELEASER_PROPERTIES=~/.jreleaser/config.toml
check_configured() {
grep -q $1 ${USER_JRELEASER_PROPERTIES} || ( echo "$1 not configured in ${USER_JRELEASER_PROPERTIES}. $2" && exit 1 )
}
check_configuration() {
if [ ! -f ${USER_JRELEASER_PROPERTIES} ]; then
echo "${USER_JRELEASER_PROPERTIES} does not exist. We use JReleaser to release packages. Pleaser create the file and add the following variables:"
echo "JRELEASER_GPG_PASSPHRASE=\"your_gpg_passphrase\""
echo "JRELEASER_GPG_PUBLIC_KEY=\"your_gpg_public_key\""
echo "JRELEASER_GPG_SECRET_KEY=\"your_gpg_secret_key\""
echo "JRELEASER_MAVENCENTRAL_USERNAME=\"your_maven_central_username\""
echo "JRELEASER_MAVENCENTRAL_PASSWORD=\"your_maven_central_password\""
echo "JRELEASER_GITHUB_TOKEN=\"your_github_token\""
exit 1
fi
check_configured "JRELEASER_GPG_PASSPHRASE" "This is the GPG passphrase for your GPG key"
check_configured "JRELEASER_GPG_PUBLIC_KEY" "This is the GPG public key to sign the release. Use 'gpg --export ***KEYID*** | base64' to export the public key"
check_configured "JRELEASER_GPG_SECRET_KEY" "This is the GPG secret key to sign the release. Use 'gpg --export-secret-keys ***KEYID*** | base64' to export the private key"
check_configured "JRELEASER_MAVENCENTRAL_USERNAME" "This is the Maven Central username to release packages"
check_configured "JRELEASER_MAVENCENTRAL_PASSWORD" "This is the Maven Central password to release packages"
check_configured "JRELEASER_GITHUB_TOKEN" "This it the Github Token to release packages and release information to GitHub"
# for GPG version >= 2.1: gpg --export-secret-keys >~/.gnupg/secring.gpg
# gpg --send-keys --keyserver keys.openpgp.org yourKeyId
}
check_configuration
set +e
grep '_version = ".*-SNAPSHOT"' "$SCRIPT_DIR/build.gradle"
SNAPSHOT=$?
set -e
if [[ $SNAPSHOT == 1 ]]; then
echo "INFO: This is not a SNAPSHOT, I'll release to Maven Central during upload."
else
echo "INFO: This is a SNAPSHOT release. Packages will be released to GitHub packages only."
fi
"${SCRIPT_DIR}"/gradlew clean jreleaserConfig check
"${SCRIPT_DIR}"/gradlew build publish
"${SCRIPT_DIR}"/gradlew jreleaserFullRelease