Skip to content

Commit 8d0fec9

Browse files
committed
ci: version resolver for release
1 parent 06ee143 commit 8d0fec9

5 files changed

Lines changed: 21 additions & 6 deletions

File tree

.github/workflows/github-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
distribution: 'graalvm-community'
4545

4646
- name: Publish Release to Github
47-
run: ./gradlew jreleaserRelease --stacktrace --no-daemon
47+
run: ./gradlew jreleaserRelease -Prelease --stacktrace --no-daemon
4848
env:
4949
JRELEASER_GITHUB_TOKEN: ${{ secrets.FLAMINGOCK_JRELEASER_GITHUB_TOKEN }}
5050
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.FLAMINGOCK_JRELEASER_GPG_PUBLIC_KEY }}

.github/workflows/module-release-graalvm.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ jobs:
6060
- name: Prepare maven publish
6161
run: |
6262
if [ -n "${{ inputs.module }}" ]; then
63-
./gradlew publish -Pmodule=${{ inputs.module }}
63+
./gradlew publish -Prelease -Pmodule=${{ inputs.module }}
6464
else
65-
./gradlew publish
65+
./gradlew publish -Prelease
6666
fi
6767
env:
6868
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_USERNAME }}
6969
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_PASSWORD }}
7070

7171
- name: Release to Maven Central portal
72-
run: ./infra/module-release-with-retry.sh ${{ inputs.module }} 5 20
72+
run: ./infra/module-release-with-retry.sh "${{ inputs.module }}" 5 20 -Prelease
7373
env:
7474
JRELEASER_GITHUB_TOKEN: ${{ secrets.FLAMINGOCK_JRELEASER_GITHUB_TOKEN }}
7575
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.FLAMINGOCK_JRELEASER_MAVENCENTRAL_USERNAME }}

build.gradle.kts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import io.flamingock.build.VersionManager
2+
import io.flamingock.build.PrintVersionTask
3+
14
plugins {
25
`java-library`
36
`maven-publish`
@@ -7,7 +10,8 @@ plugins {
710

811

912
group = "io.flamingock"
10-
version = "1.3.2-SNAPSHOT"
13+
val declaredVersion = "1.3.2-SNAPSHOT"
14+
version = VersionManager.resolveVersion(declaredVersion, project.hasProperty("release"))
1115

1216
repositories {
1317
mavenLocal()
@@ -242,3 +246,5 @@ tasks.register("createStagingDeployFolder") {
242246
tasks.matching { it.name == "publish" }.configureEach {
243247
finalizedBy("createStagingDeployFolder")
244248
}
249+
250+
tasks.register<PrintVersionTask>("printVersion")

buildSrc/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
}

infra/module-release-with-retry.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
module=$1
44
maxAttempts=${2:-3}
55
waitingSeconds=${3:-20}
6+
shift 3 2>/dev/null || true
7+
extraFlags="$*"
68

79
if [ -n "$module" ]; then
810
MODULE_FLAG="-Pmodule=$module"
@@ -12,7 +14,7 @@ else
1214
echo "Releasing bundle to Central Portal with max attempts[$maxAttempts] and $waitingSeconds seconds delay"
1315
fi
1416
for (( i=1; i<=maxAttempts; i++ )); do
15-
if ./gradlew jreleaserDeploy $MODULE_FLAG --no-daemon --stacktrace; then
17+
if ./gradlew jreleaserDeploy $MODULE_FLAG $extraFlags --no-daemon --stacktrace; then
1618
exit 0
1719
fi
1820
if [ "$i" -eq "$maxAttempts" ]; then

0 commit comments

Comments
 (0)