forked from http4k/http4k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release-maven-central-4.sh
executable file
·52 lines (40 loc) · 1.63 KB
/
release-maven-central-4.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
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
set -e
set -o errexit
set -o pipefail
set -o nounset
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
LOCAL_VERSION=`jq -r .http4k.version $DIR/version.json`
function maven_publish {
local PACKAGE=$1
local PAYLOAD="{\"username\": \"${SONATYPE_USER}\", \"password\": \"${SONATYPE_KEY}\"}"
local PUBLISHED=$(curl --fail --silent -o /dev/null https://mvnrepository.com/artifact/org.http4k/${PACKAGE}/${LOCAL_VERSION} ; echo $?)
if [[ $PUBLISHED == "0" ]]; then
echo "$PACKAGE is already published. Skipping"
else
echo "Publishing $PACKAGE..."
RESULT=$(curl -s -X POST -u "$BINTRAY_USER:$BINTRAY_KEY" -H "Content-Type: application/json" --data "$PAYLOAD" "https://bintray.com/api/v1/maven_central_sync/http4k/maven/$PACKAGE/versions/$LOCAL_VERSION")
if [[ ! "${RESULT}" =~ .*Successful.* ]]; then
echo "Failed: ${RESULT}"
exit 1
fi
fi
}
function ensure_release_commit {
local CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r HEAD)
if [[ "$CHANGED_FILES" != *version.json* ]]; then
echo "Version did not change on this commit. Ignoring"; exit 0;
fi
}
ensure_release_commit
echo "Making $LOCAL_VERSION available in Maven central..."
maven_publish "http4k-cloudnative"
maven_publish "http4k-resilience4j"
maven_publish "http4k-security-oauth"
maven_publish "http4k-metrics-micrometer"
maven_publish "http4k-template-dust"
maven_publish "http4k-template-handlebars"
maven_publish "http4k-template-pebble"
maven_publish "http4k-template-thymeleaf"
maven_publish "http4k-template-freemarker"
maven_publish "http4k-template-jade4j"