Skip to content

Commit

Permalink
Add TC job to publish to Maven Central staging repo
Browse files Browse the repository at this point in the history
  • Loading branch information
pshevche committed Mar 14, 2024
1 parent a685ef3 commit 8c12819
Show file tree
Hide file tree
Showing 2 changed files with 183 additions and 0 deletions.
122 changes: 122 additions & 0 deletions .teamcity/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?xml version="1.0"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<name>Develocity API adapters TeamCity Config DSL</name>
<groupId>com.gradle</groupId>
<artifactId>develocity-api-adapters</artifactId>

<version>1.0-SNAPSHOT</version>

<properties>
<kotlin.version>1.9.20</kotlin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.compiler.jvmTarget>11</kotlin.compiler.jvmTarget>
<kotlin.compiler.languageVersion>1.6</kotlin.compiler.languageVersion>
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<repositories>
<repository>
<id>jetbrains-all</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>teamcity-server</id>
<url>https://builds.gradle.org/app/dsl-plugins-repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>JetBrains</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
</pluginRepository>
</pluginRepositories>

<build>
<sourceDirectory>${project.basedir}</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>

<configuration>
<jvmTarget>1.8</jvmTarget>
</configuration>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>teamcity-configs-maven-plugin</artifactId>
<version>${teamcity.dsl.version}</version>
<configuration>
<format>kotlin</format>
<dstDir>target/generated-configs</dstDir>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin</artifactId>
<version>${teamcity.dsl.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin-plugins</artifactId>
<version>1.0-SNAPSHOT</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-script-runtime</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
61 changes: 61 additions & 0 deletions .teamcity/settings.kts
Original file line number Diff line number Diff line change
@@ -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%")
}
}
}

0 comments on commit 8c12819

Please sign in to comment.