-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
[gradle] Reworking publishing pipeline #2886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
ea12ed0
6b0c3fa
becc3b2
a8d4ec0
59c0ea1
9049b2a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,8 +136,8 @@ after_success: | |
| echo "Finished mvn clean deploy for $TRAVIS_BRANCH"; | ||
| pushd .; | ||
| cd modules/openapi-generator-gradle-plugin; | ||
| ./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" uploadArchives --no-daemon; | ||
| echo "Finished ./gradlew uploadArchives"; | ||
| ./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" publishPluginMavenPublicationToNexusRepository --no-daemon; | ||
| echo "Finished ./gradlew publishPluginMavenPublicationToNexusRepository"; | ||
|
||
| popd; | ||
| elif ([[ "$TRAVIS_BRANCH" =~ ^[0-9]+\.[0-9]+\.x$ ]]) ; then | ||
| mvn clean deploy --settings CI/settings.xml; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| buildscript { | ||
| ext.kotlin_version = '1.2.60' | ||
| ext.kotlin_version = '1.2.61' | ||
| repositories { | ||
| mavenCentral() | ||
| maven { | ||
|
|
@@ -11,14 +11,13 @@ buildscript { | |
| maven { | ||
| url "https://oss.sonatype.org/content/repositories/snapshots/" | ||
| } | ||
| maven { | ||
| url "https://plugins.gradle.org/m2/" | ||
| } | ||
| } | ||
| dependencies { | ||
| classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
| classpath "gradle.plugin.org.gradle.kotlin:gradle-kotlin-dsl-plugins:1.0-rc-3" | ||
| classpath "com.gradle.publish:plugin-publish-plugin:0.10.1" | ||
| classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.20.0" | ||
| classpath "de.marcphilipp.gradle:nexus-publish-plugin:0.2.0" | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -35,10 +34,11 @@ ext.isReleaseVersion = !version.endsWith("SNAPSHOT") | |
|
|
||
| apply plugin: 'com.gradle.plugin-publish' | ||
| apply plugin: 'java-gradle-plugin' | ||
| apply plugin: 'maven' | ||
| apply plugin: 'signing' | ||
| apply plugin: 'kotlin' | ||
| apply plugin: "org.gradle.kotlin.kotlin-dsl" | ||
| apply plugin: 'io.codearte.nexus-staging' | ||
| apply plugin: "de.marcphilipp.nexus-publish" | ||
|
|
||
| sourceCompatibility = 1.8 | ||
| targetCompatibility = 1.8 | ||
|
|
@@ -87,6 +87,54 @@ test { | |
| } | ||
| } | ||
|
|
||
|
|
||
| publishing { | ||
| publications { | ||
| mavenJava(MavenPublication) { | ||
| from components.java | ||
| pom { | ||
| name = 'OpenAPI-Generator Contributors' | ||
| description = project.description | ||
| url = 'https://openapi-generator.tech' | ||
| organization { | ||
| name = 'org.openapitools' | ||
| url = 'https://github.com/OpenAPITools' | ||
| } | ||
| licenses { | ||
| license { | ||
| name = "The Apache Software License, Version 2.0" | ||
| url = "http://www.apache.org/licenses/LICENSE-2.0.txt" | ||
| distribution = "repo" | ||
| } | ||
| } | ||
| developers { | ||
| developer { | ||
| id = "openapitools" | ||
| name = "OpenAPI-Generator Contributors" | ||
| email = "[email protected]" | ||
| } | ||
| } | ||
| scm { | ||
| url = 'https://github.com/OpenAPITools/openapi-generator' | ||
| connection = 'scm:git:git://github.com/OpenAPITools/openapi-generator.git' | ||
| developerConnection = 'scm:git:ssh://[email protected]:OpenAPITools/openapi-generator.git' | ||
| } | ||
| issueManagement { | ||
| system = 'GitHub' | ||
| url = 'https://github.com/OpenAPITools/openapi-generator/issues' | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| nexusPublishing { | ||
| username = ossrhUsername | ||
| password = ossrhPassword | ||
| stagingProfileId = "org.openapitools" | ||
| packageGroup = "org.openapitools" | ||
| } | ||
|
|
||
| gradlePlugin { | ||
| plugins { | ||
| openApiGenerator { | ||
|
|
@@ -109,6 +157,7 @@ pluginBundle { | |
| displayName = 'OpenAPI Generator Gradle Plugin' | ||
| tags = ['openapi-3.0', 'openapi-2.0', 'openapi', 'swagger', 'codegen', 'sdk'] | ||
| version = "$openApiGeneratorVersion" | ||
| group = "org.openapitools" | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -119,79 +168,7 @@ pluginBundle { | |
| // or stored as key=value pairs in ~/.gradle/gradle.properties | ||
| // You can also apply them in CI via environment variables. See Gradle's docs for details. | ||
| signing { | ||
| required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") } | ||
| sign configurations.archives | ||
| } | ||
|
|
||
| task javadocJar(type: Jar) { | ||
| classifier = 'javadoc' | ||
| from javadoc | ||
| } | ||
|
|
||
| task sourcesJar(type: Jar) { | ||
| from sourceSets.main.allSource | ||
| classifier = 'sources' | ||
| } | ||
|
|
||
| artifacts { | ||
| archives javadocJar, sourcesJar | ||
| } | ||
|
|
||
| def pomConfig = { | ||
| description project.description | ||
| name 'OpenAPI-Generator Contributors' | ||
| url 'https://openapi-generator.tech' | ||
| organization { | ||
| name 'org.openapitools' | ||
| url 'https://github.com/OpenAPITools' | ||
| } | ||
| licenses { | ||
| license { | ||
| name "The Apache Software License, Version 2.0" | ||
| url "http://www.apache.org/licenses/LICENSE-2.0.txt" | ||
| distribution "repo" | ||
| } | ||
| } | ||
| developers { | ||
| developer { | ||
| id "openapitools" | ||
| name "OpenAPI-Generator Contributors" | ||
| email "[email protected]" | ||
| } | ||
| } | ||
| scm { | ||
| url 'https://github.com/OpenAPITools/openapi-generator' | ||
| connection 'scm:git:git://github.com/OpenAPITools/openapi-generator.git' | ||
| developerConnection 'scm:git:ssh://[email protected]:OpenAPITools/openapi-generator.git' | ||
| } | ||
| issueManagement { | ||
| system 'GitHub' | ||
| url 'https://github.com/OpenAPITools/openapi-generator/issues' | ||
| } | ||
| } | ||
|
|
||
| uploadArchives { | ||
| repositories { | ||
|
|
||
| // credentials here would need to be passed along with the gradle command: | ||
| // ./gradlew -P ossrhUsername=yourUser | ||
| // or stored in ~/.gradle/gradle.properties as key=value pairs | ||
| mavenDeployer { | ||
| beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | ||
| repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { | ||
| authentication(userName: ossrhUsername, password: ossrhPassword) | ||
| } | ||
| snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { | ||
| authentication(userName: ossrhUsername, password: ossrhPassword) | ||
| } | ||
|
|
||
| pom.withXml { | ||
| def root = asNode() | ||
| root.appendNode('description', project.description) | ||
| root.children().last() + pomConfig | ||
| } | ||
| } | ||
| } | ||
| sign publishing.publications | ||
| } | ||
|
|
||
| compileKotlin { | ||
|
|
@@ -205,4 +182,4 @@ compileTestKotlin { | |
| } | ||
| } | ||
|
|
||
| uploadArchives.dependsOn 'check' | ||
| publishToNexus.dependsOn 'check' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| rootProject.name = 'openapi-generator-gradle-plugin' | ||
| enableFeaturePreview('STABLE_PUBLISHING') | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the 4.0.1 release fails, we may consider reverting to the
uploadArchivesandmavenpublishing plugin.