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

Commit 7bf4ac8

Browse files
committed
Include github build scripts
1 parent 90d5cb7 commit 7bf4ac8

File tree

2 files changed

+71
-1
lines changed

2 files changed

+71
-1
lines changed

build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,12 @@ subprojects {
164164
userOrg = 'graphql-java-kickstart'
165165
version {
166166
name = project.version
167+
gpg {
168+
sign = true
169+
}
167170
mavenCentralSync {
168-
close = '1'
171+
user = System.env.OSS_USER_TOKEN_KEY ?: project.findProperty('OSS_USER_TOKEN_KEY') ?: ''
172+
password = System.env.OSS_USER_TOKEN_PASS ?: project.findProperty('OSS_USER_TOKEN_PASS') ?: ''
169173
}
170174
}
171175
}

github-build.sh

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/bash
2+
set -ev
3+
4+
#saveGitCredentials() {
5+
# cat >$HOME/.netrc <<EOL
6+
#machine github.com
7+
#login ${GITHUB_USERNAME}
8+
#password ${GITHUB_TOKEN}
9+
#
10+
#machine api.github.com
11+
#login ${GITHUB_USERNAME}
12+
#password ${GITHUB_TOKEN}
13+
#EOL
14+
# chmod 600 $HOME/.netrc
15+
#}
16+
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+
55+
git config --global user.email "[email protected]"
56+
git config --global user.name "GitHub Actions"
57+
58+
echo "Deploying release to Bintray"
59+
removeSnapshots
60+
61+
./gradlew clean assemble && ./gradlew bintrayUpload -x check --info
62+
63+
commitRelease
64+
bumpVersion
65+
commitNextVersion
66+
git push --follow-tags

0 commit comments

Comments
 (0)