@@ -10,7 +10,7 @@ import java.net.URI
10
10
import java.text.SimpleDateFormat
11
11
import java.util.Date
12
12
13
- fun isSnapshotBuild () = System .getenv(" IJ_PLUGIN_SNAPSHOT " ).toBoolean()
13
+ fun isReleaseBuild () = System .getenv(" IJ_PLUGIN_RELEASE " ).toBoolean()
14
14
15
15
plugins {
16
16
alias(libs.plugins.kotlin.jvm)
@@ -32,12 +32,17 @@ repositories {
32
32
33
33
group = " com.apollographql"
34
34
35
- // Use the global version defined in the root project + dedicated suffix if building a snapshot from the CI
36
- version = project.findProperty(" VERSION_NAME" ).toString() + getSnapshotVersionSuffix()
35
+ version = getVersionName()
37
36
38
- fun getSnapshotVersionSuffix (): String {
39
- if (! isSnapshotBuild()) return " "
40
- return " .${SimpleDateFormat (" YYYY-MM-dd" ).format(Date ())} ." + System .getenv(" GITHUB_SHA" ).take(7 )
37
+ // Use the global version defined in the root project + dedicated suffix if building a snapshot from the CI.
38
+ // For releases, remove the -SNAPSHOT suffix.
39
+ fun getVersionName (): String {
40
+ val projectVersion = project.findProperty(" VERSION_NAME" ).toString()
41
+ return if (isReleaseBuild()) {
42
+ projectVersion.removeSuffix(" -SNAPSHOT" )
43
+ } else {
44
+ projectVersion + " .${SimpleDateFormat (" YYYY-MM-dd" ).format(Date ())} ." + System .getenv(" GITHUB_SHA" ).take(7 )
45
+ }
41
46
}
42
47
43
48
kotlin {
@@ -232,10 +237,10 @@ intellijPlatform {
232
237
}.joinToString(" \n " ).run { markdownToHTML(this ) }
233
238
)
234
239
changeNotes.set(
235
- if (isSnapshotBuild()) {
236
- " Weekly snapshot builds contain the latest changes from the <code>main</code> branch."
237
- } else {
240
+ if (isReleaseBuild()) {
238
241
" See the <a href=\" https://github.com/apollographql/apollo-intellij-plugin/releases/tag/v${project.version} \" >release notes</a>."
242
+ } else {
243
+ " Weekly snapshot builds contain the latest changes from the <code>main</code> branch."
239
244
}
240
245
)
241
246
}
@@ -248,7 +253,7 @@ intellijPlatform {
248
253
249
254
publishing {
250
255
token.set(System .getenv(" PUBLISH_TOKEN" ))
251
- if (isSnapshotBuild ()) {
256
+ if (! isReleaseBuild ()) {
252
257
// Read more: https://plugins.jetbrains.com/docs/intellij/publishing-plugin.html#specifying-a-release-channel
253
258
channels.set(listOf (" snapshots" ))
254
259
}
0 commit comments