File tree 2 files changed +30
-3
lines changed
2 files changed +30
-3
lines changed Original file line number Diff line number Diff line change 22
22
java-version : 17
23
23
cache : ' gradle'
24
24
25
+ - id : get-snapshot-version
26
+ name : Generate snapshot version
27
+ shell : bash
28
+ run : |
29
+ version=$(git describe --tag --abbrev=0 | cut -c 2-)
30
+ regex="^([0-9]+).([0-9]+).([0-9]+)$"
31
+ if [[ $version =~ $regex ]]; then
32
+ major="${BASH_REMATCH[1]}"
33
+ minor="${BASH_REMATCH[2]}"
34
+ patch="${BASH_REMATCH[3]}"
35
+
36
+ patch=$(($patch + 1))
37
+
38
+ snapshot_version="${major}.${minor}.${patch}"
39
+
40
+ if ! [[ $snapshot_version =~ $regex ]]; then
41
+ echo "SNAPSHOT version $snapshot_version is not a valid SemVer"
42
+ exit 1
43
+ fi
44
+
45
+ echo "${snapshot_version}-SNAPSHOT"
46
+ echo "snapshot-version=${snapshot_version}-SNAPSHOT" >> $GITHUB_OUTPUT
47
+ else
48
+ echo "Version $version is not a valid SemVer"
49
+ exit 1
50
+ fi
51
+
25
52
- name : Build with Gradle
26
- run : ./gradlew build
53
+ run : ./gradlew -Pversion=${{ steps.get-snapshot-version.outputs.snapshot-version }} build
27
54
28
55
- name : Upload snapshot artifacts to Sonatype
29
56
id : upload_snapshot_artifacts
32
59
SONATYPE_PASSWORD : ${{ secrets.SONATYPE_PASSWORD }}
33
60
GPG_KEY : ${{ secrets.GPG_KEY }}
34
61
GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
35
- run : ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
62
+ run : ./gradlew -Pversion=${{ steps.get-snapshot-version.outputs.snapshot-version }} publishToSonatype closeAndReleaseSonatypeStagingRepository
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ plugins {
6
6
}
7
7
8
8
group = " com.github.gavlyukovskiy"
9
- version = " 0.1.0-SNAPSHOT"
9
+ version = version. takeUnless { it == " unspecified " } ? : " 0.1.0-SNAPSHOT"
10
10
11
11
val sonatypeUser: String? = project.properties[" sonatype_user" ]?.toString()
12
12
? : System .getenv(" SONATYPE_USER" )
You can’t perform that action at this time.
0 commit comments