From 8c1281961fc403f57a77334f0cf3d86c60a05ba4 Mon Sep 17 00:00:00 2001 From: Pavlo Shevchenko Date: Thu, 14 Mar 2024 11:50:10 +0100 Subject: [PATCH] Add TC job to publish to Maven Central staging repo --- .teamcity/pom.xml | 122 +++++++++++++++++++++++++++++++++++++++++ .teamcity/settings.kts | 61 +++++++++++++++++++++ 2 files changed, 183 insertions(+) create mode 100644 .teamcity/pom.xml create mode 100644 .teamcity/settings.kts diff --git a/.teamcity/pom.xml b/.teamcity/pom.xml new file mode 100644 index 0000000..ce5f371 --- /dev/null +++ b/.teamcity/pom.xml @@ -0,0 +1,122 @@ + + + 4.0.0 + + org.jetbrains.teamcity + configs-dsl-kotlin-parent + 1.0-SNAPSHOT + + + Develocity API adapters TeamCity Config DSL + com.gradle + develocity-api-adapters + + 1.0-SNAPSHOT + + + 1.9.20 + UTF-8 + 11 + 1.6 + 11 + 11 + 11 + + + + + jetbrains-all + https://download.jetbrains.com/teamcity-repository + + true + + + + teamcity-server + https://builds.gradle.org/app/dsl-plugins-repository + + true + + + + + + + JetBrains + https://download.jetbrains.com/teamcity-repository + + + + + ${project.basedir} + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + 1.8 + + + + compile + compile + + compile + + + + test-compile + test-compile + + test-compile + + + + + + org.jetbrains.teamcity + teamcity-configs-maven-plugin + ${teamcity.dsl.version} + + kotlin + target/generated-configs + + + + + + + + org.jetbrains.teamcity + configs-dsl-kotlin + ${teamcity.dsl.version} + compile + + + org.jetbrains.teamcity + configs-dsl-kotlin-plugins + 1.0-SNAPSHOT + pom + compile + + + org.jetbrains.kotlin + kotlin-script-runtime + ${kotlin.version} + compile + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-test + ${kotlin.version} + test + + + diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts new file mode 100644 index 0000000..a0ee70d --- /dev/null +++ b/.teamcity/settings.kts @@ -0,0 +1,61 @@ +import jetbrains.buildServer.configs.kotlin.v2019_2.AbsoluteId +import jetbrains.buildServer.configs.kotlin.v2019_2.CheckoutMode +import jetbrains.buildServer.configs.kotlin.v2019_2.Project +import jetbrains.buildServer.configs.kotlin.v2019_2.RelativeId +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.v2019_2.project +import jetbrains.buildServer.configs.kotlin.v2019_2.toId +import jetbrains.buildServer.configs.kotlin.v2019_2.version + +version = "2022.04" + +project { + publishDevelocityApiAdapters( + "develocity-gradle-plugin-adapters", + "Develocity Gradle Plugin Adapters" + ) + publishDevelocityApiAdapters( + "develocity-maven-extension-adapters", + "Develocity Maven Extension Adapters" + ) + params { + param("env.GRADLE_ENTERPRISE_ACCESS_KEY", "%ge.gradle.org.access.key%") + param("env.GRADLE_CACHE_REMOTE_URL", "%gradle.cache.remote.url%") + param("env.GRADLE_CACHE_REMOTE_USERNAME", "%gradle.cache.remote.username%") + password("env.GRADLE_CACHE_REMOTE_PASSWORD", "%gradle.cache.remote.password%") + } +} + +fun Project.publishDevelocityApiAdapters(projectPath: String, projectDisplayName: String) { + buildType { + name = "Publish ${projectDisplayName}" + id = RelativeId(name.toId()) + description = "Publish ${projectDisplayName} to Maven Central staging repository" + + vcs { + root(AbsoluteId("OpenSourceProjects_DevelocityApiAdapters_GradleDevelocityApiAdapters")) + checkoutMode = CheckoutMode.ON_AGENT + cleanCheckout = true + } + + requirements { + contains("teamcity.agent.jvm.os.name", "Linux") + } + + steps { + gradle { + useGradleWrapper = true + tasks = "clean :${projectPath}:publishMavenJavaPublicationToSonatypeRepository" + gradleParams = "--build-cache" + } + } + params { + param("env.JDK8", "%linux.java8.oracle.64bit%") + param("env.JAVA_HOME", "%linux.java21.openjdk.64bit%") + param("env.ORG_GRADLE_PROJECT_sonatypeUsername", "%mavenCentralStagingRepoUser%") + password("env.ORG_GRADLE_PROJECT_sonatypePassword", "%mavenCentralStagingRepoPassword%") + password("env.PGP_SIGNING_KEY", "%pgpSigningKey%") + password("env.PGP_SIGNING_KEY_PASSPHRASE", "%pgpSigningPassphrase%") + } + } +}