summaryrefslogtreecommitdiffstats
path: root/distribution.sh
diff options
context:
space:
mode:
Diffstat (limited to 'distribution.sh')
-rwxr-xr-xdistribution.sh78
1 files changed, 78 insertions, 0 deletions
diff --git a/distribution.sh b/distribution.sh
new file mode 100755
index 00000000000..9679c3d6899
--- /dev/null
+++ b/distribution.sh
@@ -0,0 +1,78 @@
+#!/bin/bash
+#
+
+set -euo pipefail
+
+#
+# Evaluate a Maven expression
+#
+
+function maven_expression() {
+ mvn help:evaluate -Dexpression=$1 | grep -v '^\[\|Download\w\+\:'
+}
+
+ARTIFACTID="`maven_expression project.artifactId`"
+VERSION="`maven_expression project.version`"
+BINTRAY_REPO=Distribution
+BINTRAY_ACCOUNT=sonarsource
+
+if [[ "$VERSION" =~ "-build" ]] || [[ "$VERSION" =~ "-SNAPSHOT" ]]; then
+ echo "This is a dev build, not releasing"
+ exit 0
+else
+ echo "About to release sonarqube"
+fi
+
+cd sonar-application
+
+GROUPID="`maven_expression project.groupId`"
+ARTIFACTID="`maven_expression project.artifactId`"
+echo "$GROUPID $ARTIFACTID $VERSION"
+GROUPIDPATH=`echo $GROUPID | sed 's/\./\//g'`
+
+echo "Uploading sonarqube-$VERSION.zip to $BINTRAY_ACCOUNT/$BINTRAY_REPO"
+cd target
+
+#zip file
+
+HTTP_CODE=`curl --write-out %{http_code} -T sonarqube-$VERSION.zip -u$BINTRAY_USER:$BINTRAY_TOKEN https://api.bintray.com/content/$BINTRAY_ACCOUNT/$BINTRAY_REPO/SonarQube/$VERSION/sonarqube/`
+
+echo $HTTP_CODE
+
+if [[ "$HTTP_CODE" =~ "201" ]]; then
+ echo "Uploaded to bintray"
+ echo "https://bintray.com/$BINTRAY_ACCOUNT/$BINTRAY_REPO/SonarQube/$VERSION/view#files"
+else
+ echo "Upload to bintray failed -> $HTTP_CODE"
+ exit -1
+fi
+
+#md5 file
+
+HTTP_CODE=`curl --write-out %{http_code} -T sonarqube-$VERSION.zip.md5 -u$BINTRAY_USER:$BINTRAY_TOKEN https://api.bintray.com/content/$BINTRAY_ACCOUNT/$BINTRAY_REPO/SonarQube/$VERSION/sonarqube/`
+
+echo $HTTP_CODE
+
+if [[ "$HTTP_CODE" =~ "201" ]]; then
+ echo "Uploaded to bintray"
+ echo "https://bintray.com/$BINTRAY_ACCOUNT/$BINTRAY_REPO/SonarQube/$VERSION/view#files"
+else
+ echo "Upload to bintray failed -> $HTTP_CODE"
+ exit -1
+fi
+
+#sha file
+
+HTTP_CODE=`curl --write-out %{http_code} -T sonarqube-$VERSION.zip.sha -u$BINTRAY_USER:$BINTRAY_TOKEN https://api.bintray.com/content/$BINTRAY_ACCOUNT/$BINTRAY_REPO/SonarQube/$VERSION/sonarqube/`
+
+echo $HTTP_CODE
+
+if [[ "$HTTP_CODE" =~ "201" ]]; then
+ echo "Uploaded to bintray"
+ echo "https://bintray.com/$BINTRAY_ACCOUNT/$BINTRAY_REPO/SonarQube/$VERSION/view#files"
+else
+ echo "Upload to bintray failed -> $HTTP_CODE"
+ exit -1
+fi
+
+ \ No newline at end of file