File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 1818 id : versions
1919 shell : bash
2020 run : |
21- declare -r VERSION="$((git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*' 2>/dev/null || echo "v0.0.0") \
22- | cut -c2-)"
21+ declare -r VERSION="$((git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*' 2>/dev/null || echo "v0.0.0") | cut -c2-)"
2322 declare -r MAJOR="$(echo "$VERSION" | cut -d. -f1)"
2423 declare -r MINOR="$(echo "$VERSION" | cut -d. -f2)"
2524 declare -r PATCH="$(echo "$VERSION" | cut -d. -f3)"
6059 tag : v${{ steps.versions.outputs.next_version }}
6160 token : ${{ secrets.GITHUB_TOKEN }}
6261
63- - name : Publish snapshot to maven central
64- if : " github.ref == 'refs/heads/master'"
65- shell : bash
66- run : echo ">>> Publish Snapshot ${{ steps.versions.outputs.next_version }}-SNAPSHOT"
Original file line number Diff line number Diff line change 2525 java-version : 11
2626 distribution : temurin
2727
28+ - name : Cache gradle
29+ uses : actions/cache@v2
30+ with :
31+ path : |
32+ ~/.gradle/caches
33+ ~/.gradle/wrapper
34+ key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
35+ restore-keys : ${{ runner.os }}-gradle
36+
2837 - name : Publish release
2938 if : startsWith(github.ref, 'refs/tags/v')
3039 env :
@@ -44,10 +53,11 @@ jobs:
4453 NEXUS_USERNAME : ${{ secrets.NEXUS_USERNAME }}
4554 NEXUS_PASSWORD : ${{ secrets.NEXUS_PASSWORD }}
4655 run : |
47- declare -r VERSION="$(git describe --abbrev=0 --tags --match 'v[0-9]*' 2>/dev/null || echo "v0.0.0" | cut -c2-)"
56+ declare -r VERSION="$(( git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]* ' 2>/dev/null || echo "v0.0.0") | cut -c2-)"
4857 declare -r MAJOR="$(echo "$VERSION" | cut -d. -f1)"
4958 declare -r MINOR="$(echo "$VERSION" | cut -d. -f2)"
5059 declare -r PATCH="$(echo "$VERSION" | cut -d. -f3)"
5160 declare -r NEXT_VERSION="$MAJOR.$MINOR.$(( $PATCH + 1 ))"
52- ./gradlew publishToSonatype -Pversion="${NEXT_VERSION}-${GITHUB_REF#refs/heads/}-SNAPSHOT" -Ppublish
53- echo "Published snapshot: ${NEXT_VERSION}-${GITHUB_REF#refs/heads/}-SNAPSHOT"
61+ declare -r MIDDLE="$([ "$GITHUB_REF" == "refs/heads/master" ] && echo "" || echo "-${GITHUB_REF#refs/heads/}")"
62+ ./gradlew publishToSonatype -Pversion="${NEXT_VERSION}${MIDDLE}-SNAPSHOT" -Ppublish
63+ echo "Published snapshot: ${NEXT_VERSION}${MIDDLE}-SNAPSHOT"
You can’t perform that action at this time.
0 commit comments