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

Commit 04c185d

Browse files
committed
Include github build script
1 parent 896f3f2 commit 04c185d

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

github-build.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
set -ev
3+
4+
getVersion() {
5+
./gradlew properties -q | grep "version:" | grep -v "kotlin_version:" | awk '{print $2}' | tr -d '[:space:]'
6+
}
7+
8+
removeSnapshots() {
9+
sed -i 's/-SNAPSHOT//' gradle.properties
10+
}
11+
12+
commitRelease() {
13+
local APP_VERSION=$(getVersion)
14+
git commit -a -m "Update version for release"
15+
git tag -a "v${APP_VERSION}" -m "Tag release version"
16+
}
17+
18+
bumpVersion() {
19+
echo "Bump version number"
20+
local APP_VERSION=$(getVersion | xargs)
21+
local SEMANTIC_REGEX='^([0-9]+)\.([0-9]+)(\.([0-9]+))?$'
22+
if [[ ${APP_VERSION} =~ ${SEMANTIC_REGEX} ]]; then
23+
if [[ ${BASH_REMATCH[4]} ]]; then
24+
nextVersion=$((BASH_REMATCH[4] + 1))
25+
nextVersion="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${nextVersion}-SNAPSHOT"
26+
else
27+
nextVersion=$((BASH_REMATCH[2] + 1))
28+
nextVersion="${BASH_REMATCH[1]}.${nextVersion}-SNAPSHOT"
29+
fi
30+
31+
echo "Next version: ${nextVersion}"
32+
sed -i -E "s/^version(\s)?=.*/version=${nextVersion}/" gradle.properties
33+
else
34+
echo "No semantic version and therefore cannot publish to maven repository: '${APP_VERSION}'"
35+
fi
36+
}
37+
38+
commitNextVersion() {
39+
git commit -a -m "Update version for release"
40+
}
41+
42+
git config --global user.email "[email protected]"
43+
git config --global user.name "GitHub Actions"
44+
45+
echo "Deploying release to Bintray"
46+
removeSnapshots
47+
48+
./gradlew clean assemble && ./gradlew bintrayUpload -x check --info
49+
50+
commitRelease
51+
bumpVersion
52+
commitNextVersion
53+
git push --follow-tags

0 commit comments

Comments
 (0)