-
Notifications
You must be signed in to change notification settings - Fork 3
/
upload_release.sh
32 lines (26 loc) · 1.33 KB
/
upload_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
set -e
set -u
git checkout release
current=`mvn help:evaluate -Dexpression=project.version 2>/dev/null| grep -v "^\["`
if [[ "$current" == *-SNAPSHOT ]]
then
echo "cannot upload a snapshot release ($current)"
exit -1
fi
if [[ ! -e releases/$current/xflat-$current.jar ||
! -e releases/$current/xflat-$current-sources.jar ||
! -e releases/$current/xflat-$current-javadoc.jar ||
! -e releases/$current/pom.xml ]]
then
echo "artifacts for version $current not found!"
exit -1
fi
read -e -p "Deploy version $current to Maven Central? (y/n)" deploy
if [[ $deploy == "y" ]]
then
mvn gpg:sign-and-deploy-file -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=sonatype-nexus-staging -DpomFile=releases/$current/pom.xml -Dfile=releases/$current/xflat-$current.jar
mvn gpg:sign-and-deploy-file -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=sonatype-nexus-staging -DpomFile=releases/$current/pom.xml -Dfile=releases/$current/xflat-$current-sources.jar -Dclassifier=sources
mvn gpg:sign-and-deploy-file -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=sonatype-nexus-staging -DpomFile=releases/$current/pom.xml -Dfile=releases/$current/xflat-$current-javadoc.jar -Dclassifier=javadoc
echo "deployed version $current to sonatype repo"
fi
exit 0