-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.sh
executable file
·39 lines (29 loc) · 953 Bytes
/
publish.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
#!/bin/bash
username=$1
password=$2
# check if the username is defined in gradle.properties
userFromGradleProperties=`./gradlew -q properties | grep mavenRepoUser`
if [[ "${username}" == "" && "${userFromGradleProperties}" == "" ]]; then
read -p "Username: " username
fi
# check if the password is defined in gradle.properties
passwordFromGradleProperties=`./gradlew -q properties | grep mavenRepoPassword`
if [[ "${password}" == "" && "${passwordFromGradleProperties}" == "" ]]; then
read -s -p "Password: " password
fi
echo ""
projectVersion=`./gradlew -q version`
echo "Publish ${projectVersion}"
userArg=""
if [[ "${username}" != "" ]]; then
userArg="-PmavenRepoUser=${username}"
fi
passwordArg=""
if [[ "${password}" != "" ]]; then
passwordArg="-PmavenRepoPassword=${password}"
fi
# tag the current branch
git tag ${projectVersion}
git push --tags
# publish the artifacts
./gradlew ${userArg} ${passwordArg} clean publish