Skip to content

Commit 02cd554

Browse files
authored
Merge pull request #43 from londonbrown/master
Change versioning to include patch number and build metadata
2 parents d2bb757 + 0429da2 commit 02cd554

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

build.gradle.kts

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ val pluginGroup: String by project
7777
// `pluginName_` variable ends with `_` because of the collision with Kotlin magic getter in the `intellij` closure.
7878
// Read more about the issue: https://github.com/JetBrains/intellij-platform-plugin-template/issues/29
7979
val pluginName_: String by project
80-
val pluginVersion: String = pluginVersion(major = "2", minor = "1", patch = "1")
80+
val pluginVersion: String = pluginVersion(major = "2", minor = "2", patch = "0")
8181
val pluginDescriptionFile: String by project
8282
val pluginChangeNotesFile: String by project
8383

@@ -168,12 +168,34 @@ tasks {
168168
fun readResource(name: String) = file("resources/$name").readText()
169169

170170
/**
171-
* Function which creates a plugin version.
171+
* Function which creates a plugin version in SemVer format
172+
*
173+
* Examples:
174+
*
175+
* GIVEN (GitHub workflow environment):
176+
* GITHUB_RUN_NUMBER: 30
177+
* major: 2
178+
* minor: 1
179+
* patch: 1
180+
* sdkVersion: IC-2022.2
181+
*
182+
* RETURNS:
183+
* 2.1.1+30-IC-2022.2
184+
*
185+
*
186+
* GIVEN (local dev environment):
187+
* GITHUB_RUN_NUMBER: null
188+
* major: 2
189+
* minor: 2
190+
* patch: 34
191+
* sdkVersion: IC-2022.3
192+
*
193+
* RETURNS:
194+
* 2.2.34+0-IC-2022.3+alpha
172195
*/
173196
fun pluginVersion(major: String, minor: String, patch: String) =
174197
listOf(
175198
major,
176199
minor,
177-
patch,
178-
maybeGithubRunNumber?.let { "$it-${descriptor.sdkVersion}" } ?: "0-${descriptor.sdkVersion}+alpha"
200+
maybeGithubRunNumber?.let { "$patch+$it-${descriptor.sdkVersion}" } ?: "$patch+0-${descriptor.sdkVersion}+alpha"
179201
).joinToString(".")

0 commit comments

Comments
 (0)