Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/update_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
git config user.name "GitHub Action"
git checkout -b $BRANCH
git add CHANGELOG.md
git add gradle.properties
git commit -am "Changelog update - $NEW_VERSION"
git push --set-upstream --force-with-lease origin $BRANCH

Expand Down
37 changes: 12 additions & 25 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import org.gradle.internal.classpath.Instrumented.systemProperty
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import java.net.URL
Expand Down Expand Up @@ -98,7 +97,7 @@ dependencies {

intellijPlatform {
pluginConfiguration {
version = providers.gradleProperty("pluginVersion").map { it.substringBefore('-', "") }
version = providers.gradleProperty("pluginVersion")
description =
providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
Expand All @@ -108,26 +107,12 @@ intellijPlatform {
if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
subList(indexOf(start) + 1, indexOf(end))
.joinToString("\n")
.let(::markdownToHTML)
}
}

val changelog = project.changelog
changeNotes =
providers
.gradleProperty("pluginVersion")
.map { it.substringBefore('-', "") }
.map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML,
)
}
}

ideaVersion {
sinceBuild = providers.gradleProperty("pluginSinceBuild")
untilBuild = providers.gradleProperty("pluginUntilBuild")
Expand All @@ -141,12 +126,11 @@ intellijPlatform {
}

publishing {
// TODO: During release, refrain from reformatting the version number.
// Instead, set the release version before tagging to allow releases to any chosen channel.
token = providers.environmentVariable("PUBLISH_TOKEN")
version =
providers.gradleProperty("pluginVersion").map { it.substringBefore('-', "") }
channels = listOf("default")
channels =
providers
.gradleProperty("pluginVersion")
.map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
}

pluginVerification {
Expand Down Expand Up @@ -294,7 +278,7 @@ tasks.register("updateChangelog") {
.trim()
}

val tagsOutput = runCommand("git tag --sort=-v:refname")
val tagsOutput = runCommand("git tag --sort=-v:creatordate")
val semverRegex = Regex("^\\d+\\.\\d+\\.\\d+$")
val tags = tagsOutput.lines().filter { semverRegex.matches(it) }
if (tags.isEmpty()) {
Expand Down Expand Up @@ -433,6 +417,9 @@ tasks.register("updateChangelog") {
changelogFile.writeText(updatedContent)
changelogFile.appendText("[$newVersion]: $repoUrl/compare/$lastTag...$newVersion\n")

// Update Version Gradle pluginVersion
replaceVersionGradleProperty(newVersion)

val githubEnv = System.getenv("GITHUB_ENV")
val envFile = File(githubEnv)
envFile.appendText("NEW_VERSION=$newVersion\n")
Expand Down
Loading