-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·42 lines (33 loc) · 1.57 KB
/
release.sh
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
#!/usr/bin/env bash
set -e
SCRIPT_DIR=$(dirname $0)
USER_GRADLE_PROPERTIES=$HOME/.gradle/gradle.properties
check_configured() {
grep -q "$1" ${USER_GRADLE_PROPERTIES} || echo "$1 not configured in ${USER_GRADLE_PROPERTIES}. $2"
}
check_configuration() {
if [ ! -f ${USER_GRADLE_PROPERTIES} ]; then
echo "${USER_GRADLE_PROPERTIES} does not exist"
exit 1
fi
check_configured "sonatypeUsername" "This is the username you use to authenticate with sonatype nexus (e.g. otto-de)"
check_configured "sonatypePassword" "This is the password you use to authenticate with sonatype nexus (ask Guido or one of the developers)"
check_configured "signing.secretKeyRingFile" "This is the gpg secret key file, e.g. ~/.gnupg/secring.gpg. If this doesn't exist, generate a key: gpg --gen-key"
check_configured "signing.keyId" "This is the id of your key (e.g. 72FE5380). Use gpg --list-keys to find yours"
check_configured "signing.password" "This is the password you defined for your gpg key"
# gpg --send-keys --keyserver keyserver.ubuntu.com yourKeyId
}
check_configuration
set +e
grep 'version = .*-SNAPSHOT' "$SCRIPT_DIR/gradle.properties"
SNAPSHOT=$?
set -e
"${SCRIPT_DIR}"/gradlew clean check
if [[ $SNAPSHOT == 1 ]]; then
echo "Publishing, closing and releasing into Sonatype OSS repository"
"${SCRIPT_DIR}"/gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
else
echo "Publishing into Sonatype OSS repository"
"${SCRIPT_DIR}"/gradlew publishToSonatype
echo "This is a snapshot release. Closing in sonatype is not necessary"
fi