Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit 274e7c0

Browse files
committed
Update build script with automatic versioning
1 parent efb3476 commit 274e7c0

File tree

3 files changed

+48
-2
lines changed

3 files changed

+48
-2
lines changed

altair-spring-boot-autoconfigure/src/main/java/graphql/kickstart/altair/boot/AltairProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static class Static {
2828
@Data
2929
static class Cdn {
3030
private boolean enabled = false;
31-
private String version = "2.1.7";
31+
private String version = "2.4.6";
3232
}
3333

3434
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ TARGET_COMPATIBILITY = 1.8
4141

4242
LIB_GRAPHQL_JAVA_VER = 14.0
4343
LIB_SPRING_BOOT_VER = 2.2.6.RELEASE
44-
LIB_GRAPHQL_SERVLET_VER = 9.1.0
44+
LIB_GRAPHQL_SERVLET_VER = 9.2.0-SNAPSHOT
4545
LIB_GRAPHQL_JAVA_TOOLS_VER = 6.1.0-SNAPSHOT
4646
LIB_APACHE_COMMONS_TEXT=1.8
4747
LIB_JSOUP_VER=1.12.2

travis-build.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,57 @@ EOL
1414
chmod 600 $HOME/.netrc
1515
}
1616

17+
getVersion() {
18+
./gradlew properties -q | grep "version:" | grep -v "kotlin_version:" | awk '{print $2}' | tr -d '[:space:]'
19+
}
20+
21+
removeSnapshots() {
22+
sed -i 's/-SNAPSHOT//' gradle.properties
23+
}
24+
25+
commitRelease() {
26+
local APP_VERSION=$(getVersion)
27+
git commit -a -m "Update version for release"
28+
git tag -a "v${APP_VERSION}" -m "Tag release version"
29+
}
30+
31+
bumpVersion() {
32+
echo "Bump version number"
33+
local APP_VERSION=$(getVersion | xargs)
34+
local SEMANTIC_REGEX='^([0-9]+)\.([0-9]+)(\.([0-9]+))?$'
35+
if [[ ${APP_VERSION} =~ ${SEMANTIC_REGEX} ]]; then
36+
if [[ ${BASH_REMATCH[4]} ]]; then
37+
nextVersion=$((BASH_REMATCH[4] + 1))
38+
nextVersion="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${nextVersion}-SNAPSHOT"
39+
else
40+
nextVersion=$((BASH_REMATCH[2] + 1))
41+
nextVersion="${BASH_REMATCH[1]}.${nextVersion}-SNAPSHOT"
42+
fi
43+
44+
echo "Next version: ${nextVersion}"
45+
sed -i -E "s/^version(\s)?=.*/version=${nextVersion}/" gradle.properties
46+
else
47+
echo "No semantic version and therefore cannot publish to maven repository: '${APP_VERSION}'"
48+
fi
49+
}
50+
51+
commitNextVersion() {
52+
git commit -a -m "Update version for release"
53+
}
54+
1755
if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ]; then
1856
if [ "${RELEASE}" = "true" ]; then
1957
echo "Deploying release to Bintray"
2058
saveGitCredentials
59+
git checkout -f ${TRAVIS_BRANCH}
60+
removeSnapshots
61+
2162
./gradlew clean assemble && ./gradlew check --info && ./gradlew bintrayUpload -x check --info
63+
64+
commitRelease
65+
bumpVersion
66+
commitNextVersion
67+
git push --follow-tags
2268
else
2369
echo "Deploying snapshot"
2470
saveGitCredentials

0 commit comments

Comments
 (0)