Skip to content

Commit

Permalink
Update release script to update versions in IJ plugin (#5303)
Browse files Browse the repository at this point in the history
  • Loading branch information
BoD authored Oct 16, 2023
1 parent bd33056 commit 9e204db
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions scripts/release.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ val releaseBranchName = "release-$versionToRelease"
runCommand("git", "checkout", "-b", releaseBranchName)
setCurrentVersion(versionToRelease)
setVersionInDocs(versionToRelease, nextSnapshot)
setVersionInIntelliJPlugin(versionToRelease)
runCommand("git", "commit", "-a", "-m", "release $versionToRelease")
runCommand("git", "push", "origin", releaseBranchName)
runCommand("gh", "pr", "create", "--base", startBranch, "--fill")
Expand Down Expand Up @@ -207,6 +208,53 @@ fun setVersionInDocs(version: String, nextSnapshot: String) {
}
}

fun setVersionInIntelliJPlugin(version: String) {
File("intellij-plugin/src/main/kotlin/com/apollographql/ijplugin/refactoring/migration/v3tov4/ApolloV3ToV4MigrationProcessor.kt").let { file ->
file.writeText(file.readText().replace(Regex("""apollo4LatestVersion = "(.+)"""")) {
"""apollo4LatestVersion = "$version""""
})
}
File("intellij-plugin/src/test/testData/inspection/Apollo4Available.gradle.kts").let { file ->
file.writeText(file.readText()
.replace(Regex("""id\("com\.apollographql\.apollo3"\) version "4(.+)""")) {
"""id("com.apollographql.apollo3") version "$version""""
}
.replace(Regex("""id\("com\.apollographql\.apollo3"\)\.version\("4(.+)""")) {
"""id("com.apollographql.apollo3").version("$version")"""
}
.replace(Regex("""implementation\("com\.apollographql\.apollo3", "apollo-runtime", "4(.+)""")) {
"""implementation("com.apollographql.apollo3", "apollo-runtime", "$version")"""
}
.replace(Regex("""implementation\("com\.apollographql\.apollo3:apollo-runtime:4(.+)""")) {
"""implementation("com.apollographql.apollo3:apollo-runtime:$version")"""
}
)
}
File("intellij-plugin/src/test/testData/migration/v3-to-v4/updateGradleDependenciesInLibsVersionsToml_after.versions.toml").let { file ->
file.writeText(file.readText()
.replace(Regex("""com\.apollographql\.apollo3:apollo-runtime:4(.+)""")) {
"""com.apollographql.apollo3:apollo-runtime:$version"""
}
.replace(Regex("""com\.apollographql\.apollo3:4(.+)""")) {
"""com.apollographql.apollo3:$version"""
}
.replace(Regex(""""4(.+)"""")) {
""""$version""""
}
)
}
File("intellij-plugin/src/test/testData/migration/v3-to-v4/upgradeGradlePluginInBuildGradleKts_after.gradle.kts").let { file ->
file.writeText(file.readText()
.replace(Regex(""""4(.+)"""")) {
""""$version""""
}
.replace(Regex("""// TODO: Update version to 4(.+)""")) {
"""// TODO: Update version to $version"""
}
)
}
}

fun mergeAndWait(branchName: String) {
runCommand("gh", "pr", "merge", branchName, "--squash", "--auto", "--delete-branch")
println("Waiting for the PR to be merged...")
Expand Down

0 comments on commit 9e204db

Please sign in to comment.