diff --git a/scripts/release.main.kts b/scripts/release.main.kts index fd3d97092e6..76b44a3fc91 100755 --- a/scripts/release.main.kts +++ b/scripts/release.main.kts @@ -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") @@ -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...")