@@ -2,7 +2,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
22import com.fasterxml.jackson.annotation.JsonProperty
33import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
44import org.gradle.internal.classpath.Instrumented.systemProperty
5- import org.jetbrains.changelog.Changelog
65import org.jetbrains.changelog.markdownToHTML
76import org.jetbrains.intellij.platform.gradle.TestFrameworkType
87import java.net.URL
@@ -98,7 +97,7 @@ dependencies {
9897
9998intellijPlatform {
10099 pluginConfiguration {
101- version = providers.gradleProperty(" pluginVersion" ).map { it.substringBefore( ' - ' , " " ) }
100+ version = providers.gradleProperty(" pluginVersion" )
102101 description =
103102 providers.fileContents(layout.projectDirectory.file(" README.md" )).asText.map {
104103 val start = " <!-- Plugin description -->"
@@ -108,26 +107,12 @@ intellijPlatform {
108107 if (! containsAll(listOf (start, end))) {
109108 throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
110109 }
111- subList(indexOf(start) + 1 , indexOf(end)).joinToString(" \n " ).let (::markdownToHTML)
110+ subList(indexOf(start) + 1 , indexOf(end))
111+ .joinToString(" \n " )
112+ .let (::markdownToHTML)
112113 }
113114 }
114115
115- val changelog = project.changelog
116- changeNotes =
117- providers
118- .gradleProperty(" pluginVersion" )
119- .map { it.substringBefore(' -' , " " ) }
120- .map { pluginVersion ->
121- with (changelog) {
122- renderItem(
123- (getOrNull(pluginVersion) ? : getUnreleased())
124- .withHeader(false )
125- .withEmptySections(false ),
126- Changelog .OutputType .HTML ,
127- )
128- }
129- }
130-
131116 ideaVersion {
132117 sinceBuild = providers.gradleProperty(" pluginSinceBuild" )
133118 untilBuild = providers.gradleProperty(" pluginUntilBuild" )
@@ -141,12 +126,11 @@ intellijPlatform {
141126 }
142127
143128 publishing {
144- // TODO: During release, refrain from reformatting the version number.
145- // Instead, set the release version before tagging to allow releases to any chosen channel.
146129 token = providers.environmentVariable(" PUBLISH_TOKEN" )
147- version =
148- providers.gradleProperty(" pluginVersion" ).map { it.substringBefore(' -' , " " ) }
149- channels = listOf (" default" )
130+ channels =
131+ providers
132+ .gradleProperty(" pluginVersion" )
133+ .map { listOf (it.substringAfter(' -' , " " ).substringBefore(' .' ).ifEmpty { " default" }) }
150134 }
151135
152136 pluginVerification {
@@ -294,7 +278,7 @@ tasks.register("updateChangelog") {
294278 .trim()
295279 }
296280
297- val tagsOutput = runCommand(" git tag --sort=-v:refname " )
281+ val tagsOutput = runCommand(" git tag --sort=-v:creatordate " )
298282 val semverRegex = Regex (" ^\\ d+\\ .\\ d+\\ .\\ d+$" )
299283 val tags = tagsOutput.lines().filter { semverRegex.matches(it) }
300284 if (tags.isEmpty()) {
@@ -433,6 +417,9 @@ tasks.register("updateChangelog") {
433417 changelogFile.writeText(updatedContent)
434418 changelogFile.appendText(" [$newVersion ]: $repoUrl /compare/$lastTag ...$newVersion \n " )
435419
420+ // Update Version Gradle pluginVersion
421+ replaceVersionGradleProperty(newVersion)
422+
436423 val githubEnv = System .getenv(" GITHUB_ENV" )
437424 val envFile = File (githubEnv)
438425 envFile.appendText(" NEW_VERSION=$newVersion \n " )
0 commit comments