Skip to content

Commit a9b9631

Browse files
committed
Use separate env.RELEASE_PUBLICATION to detect release publication mode
1 parent e043e4e commit a9b9631

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

.github/workflows/publishMavenCentral.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ jobs:
3232
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_TOKEN }}
3333
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
3434
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
35-
GITHUB_RUN_NUMBER: '-1' # this means that a base version won't have a suffix i.e., the version will be `0.1`
35+
RELEASE_PUBLICATION: 'true'

build.gradle.kts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ plugins {
55
}
66

77
private val buildNumber: String? = System.getenv("GITHUB_RUN_NUMBER")
8+
private val isReleasePublication = System.getenv("RELEASE_PUBLICATION")?.toBoolean() ?: false
89

9-
private val baseVersion = "0.1"
10+
private val baseVersion = "0.1.0"
1011

1112
allprojects {
1213
group = "com.agentclientprotocol"
13-
version = when (buildNumber) {
14-
"-1" -> baseVersion // -1 as a buildNumber means that we are releasing this version
15-
null -> "$baseVersion-SNAPSHOT"
16-
else -> "$baseVersion-dev$buildNumber"
14+
version = when {
15+
isReleasePublication -> baseVersion
16+
buildNumber == null -> "$baseVersion-SNAPSHOT"
17+
else -> "$baseVersion-dev-$buildNumber"
1718
}
1819
}

0 commit comments

Comments
 (0)