File tree Expand file tree Collapse file tree 6 files changed +153
-47
lines changed Expand file tree Collapse file tree 6 files changed +153
-47
lines changed Original file line number Diff line number Diff line change 1+ name : Pull request
2+ on :
3+ pull_request :
4+ types : [ opened, reopened, synchronize ]
5+ jobs :
6+ build :
7+ runs-on : ubuntu-latest
8+ strategy :
9+ matrix :
10+ java : [ '8', '11', '15' ]
11+ steps :
12+ - name : Checkout
13+ uses : actions/checkout@v2
14+ - name : Setup java
15+ uses : actions/setup-java@v2
16+ with :
17+ java-version : ${{ matrix.java }}
18+ distribution : ' adopt'
19+ - name : Cache Maven packages
20+ uses : actions/cache@v2
21+ with :
22+ path : ~/.m2
23+ key : ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
24+ restore-keys : ${{ runner.os }}-m2
25+ - name : Build with Maven
26+ run : mvn --batch-mode --update-snapshots verify
Original file line number Diff line number Diff line change 1+ name : Release
2+ on : [ workflow_dispatch ]
3+ jobs :
4+ build :
5+ runs-on : ubuntu-latest
6+ steps :
7+ - name : Checkout
8+ uses : actions/checkout@v2
9+ - name : Setup java
10+ uses : actions/setup-java@v2
11+ with :
12+ java-version : ' 8'
13+ distribution : ' adopt'
14+ - name : Build with Maven
15+ run : mvn --batch-mode --update-snapshots verify
16+
17+ publish :
18+ runs-on : ubuntu-latest
19+ needs : build
20+ steps :
21+ - name : Checkout
22+ uses : actions/checkout@v2
23+ - name : Setup Bintray
24+ uses : actions/setup-java@v2
25+ with :
26+ java-version : ' 8'
27+ distribution : ' adopt'
28+ server-id : bintray
29+ server-username : BINTRAY_USER
30+ server-password : BINTRAY_PASSWORD
31+ - name : Publish release
32+ run : bash github-build.sh
33+ env :
34+ MAVEN_USERNAME : ${{ secrets.OSS_USER_TOKEN_KEY }}
35+ MAVEN_PASSWORD : ${{ secrets.OSS_USER_TOKEN_PASS }}
Original file line number Diff line number Diff line change 1+ name : Release Snapshot
2+ on :
3+ push :
4+ branches :
5+ - master
6+ jobs :
7+ build :
8+ runs-on : ubuntu-latest
9+ steps :
10+ - name : Checkout
11+ uses : actions/checkout@v2
12+ - name : Setup java
13+ uses : actions/setup-java@v2
14+ with :
15+ java-version : ' 8'
16+ distribution : ' adopt'
17+ - name : Build with Maven
18+ run : mvn --batch-mode --update-snapshots verify
19+
20+ publish :
21+ runs-on : ubuntu-latest
22+ needs : build
23+ steps :
24+ - name : Checkout
25+ uses : actions/checkout@v2
26+ - name : Setup Bintray
27+ uses : actions/setup-java@v2
28+ with :
29+ java-version : ' 8'
30+ distribution : ' adopt'
31+ server-id : bintray
32+ server-username : BINTRAY_USER
33+ server-password : BINTRAY_PASSWORD
34+ - name : Publish release
35+ run : mvn --batch-mode -Pbintray deploy
36+ env :
37+ MAVEN_USERNAME : ${{ secrets.OSS_USER_TOKEN_KEY }}
38+ MAVEN_PASSWORD : ${{ secrets.OSS_USER_TOKEN_PASS }}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -ev
3+
4+ getVersion () {
5+ grep -m1 -o ' [^<>]*-SNAPSHOT' pom.xml
6+ }
7+
8+ removeSnapshots () {
9+ sed -i ' s/-SNAPSHOT//' pom.xml
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 " '0,/<version>.*<\/version>/s//<version>${nextVersion} <\/version>/'" pom.xml
33+
34+ else
35+ echo " No semantic version and therefore cannot publish to maven repository: '${APP_VERSION} '"
36+ fi
37+ }
38+
39+ commitNextVersion () {
40+ git commit -a -m " Update version for release"
41+ }
42+
43+ git config --global user.email " actions@github.com"
44+ git config --global user.name " GitHub Actions"
45+
46+ echo " Deploying release to Bintray"
47+ removeSnapshots
48+
49+ mvn release:clean release:prepare release:perform -B -e -Pbintray
50+
51+ commitRelease
52+ bumpVersion
53+ commitNextVersion
54+ git push --follow-tags
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments