forked from jcefmaven/jcefmaven
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload_artifact.sh
executable file
·33 lines (26 loc) · 1.08 KB
/
upload_artifact.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
#!/bin/bash
if [ ! $# -eq 6 ]
then
echo "Usage: ./upload_artifact.sh <stageRepoUrl> <releaseRepoUrl> <repoId> <groupId> <artifactId> <version>"
echo "Release repo url should NOT end in /!"
exit 1
fi
stageRepoUrl=$1
releaseRepoUrl=$2
repoId=$3
groupId=$4
artifactId=$5
version=$6
#CD to the upload dir
cd "$( dirname "$0" )" && cd upload
pathGroupId=$(sed 's|\.|\/|g' <<< $groupId)
targetUrl=$releaseRepoUrl/$pathGroupId/$artifactId/$version/$artifactId-$version.jar
#On GitHub this check will always fail. Single pushes may return an error,
#but that is not really an error worth solving. On OSSRH, to prevent conflicts,
#no builds will be staged that are already published.
if curl --output /dev/null --silent --fail -r 0-0 "$targetUrl"; then
echo "Artifact $artifactId-$version aready pushed - skipping!"
exit 0
fi
echo "Pushing $artifactId-$version..."
mvn gpg:sign-and-deploy-file -Durl=$stageRepoUrl -DrepositoryId=$repoId -DpomFile=$artifactId-$version.pom -Dfile=$artifactId-$version.jar -Djavadoc=$artifactId-$version-javadoc.jar -Dsources=$artifactId-$version-sources.jar