This repository was archived by the owner on Dec 19, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments