diff --git a/README.md b/README.md index e7ac84992..ae8934bf7 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,8 @@ Or release multiple SDKs at once. Without `-b` or `-v`, the current version from ./bake-sdk-release -t all # all SDKs, keep current version ./bake-sdk-release -t all -b minor # all SDKs, bump minor ./bake-sdk-release -t all -b patch # all SDKs, bump patch -./bake-sdk-release -t all -v 2.0.0 # all SDKs, explicit version +./bake-sdk-release -t all -v 2.0.0 # all SDKs, explicit version +./bake-sdk-release -t all -d # all SDKs, do a dry run - no commit, push ``` The `-b` flag accepts `major`, `minor`, or `patch`. diff --git a/sdks/java-v1/.github/workflows/close-and-release-repository.yml b/sdks/java-v1/.github/workflows/close-and-release-repository.yml index 4aed1f0c3..8f07b7ed9 100644 --- a/sdks/java-v1/.github/workflows/close-and-release-repository.yml +++ b/sdks/java-v1/.github/workflows/close-and-release-repository.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: repository: - description: 'Manually trigger gradle closeAndReleaseRepository task in case of timeout from previous publishing' + description: 'Manually trigger release in case of timeout from previous publishing' jobs: closeAndReleaseRepository: @@ -20,7 +20,9 @@ jobs: java-version: 11 - name: Publish Release to Maven Central - run: ./gradlew closeAndReleaseRepository --no-daemon --no-parallel --repository ${{ inputs.repository }} + run: ./gradlew publishAndReleaseToMavenCentral --no-daemon --no-parallel --no-configuration-cache --stacktrace env: ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} diff --git a/sdks/java-v1/.github/workflows/github-actions.yml b/sdks/java-v1/.github/workflows/github-actions.yml index 913f790a6..8a5616e8d 100644 --- a/sdks/java-v1/.github/workflows/github-actions.yml +++ b/sdks/java-v1/.github/workflows/github-actions.yml @@ -47,23 +47,26 @@ jobs: distribution: 'zulu' java-version: 11 - - name: Upload Artifacts - run: ./gradlew publishToMavenCentral --no-daemon --no-parallel --no-configuration-cache --stacktrace + - name: Retrieve version + run: echo "PACKAGE_VERSION=$(cat VERSION)" >> $GITHUB_ENV + + - name: Publish to Maven Central + run: ./gradlew publishAndReleaseToMavenCentral --no-daemon --no-parallel --no-configuration-cache --stacktrace + if: "!endsWith(env.PACKAGE_VERSION, '-SNAPSHOT')" env: ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} - - name: Retrieve version - run: echo "PACKAGE_VERSION=$(cat VERSION)" >> $GITHUB_ENV - - - name: Publish Release to Maven Central - run: ./gradlew releaseRepository --no-daemon --no-parallel - if: "!endsWith(env.PACKAGE_VERSION, '-SNAPSHOT')" + - name: Publish Snapshot + run: ./gradlew publishToMavenCentral --no-daemon --no-parallel --no-configuration-cache --stacktrace + if: "endsWith(env.PACKAGE_VERSION, '-SNAPSHOT')" env: ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} # This job runs on merging to "v1" branch # Creates a new tag using the value in the VERSION file diff --git a/sdks/java-v1/build.gradle b/sdks/java-v1/build.gradle index 163f24e24..f4d6098ee 100644 --- a/sdks/java-v1/build.gradle +++ b/sdks/java-v1/build.gradle @@ -1,44 +1,33 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:2.3.+' - classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' - classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.25.0' - } -} plugins { + id 'java' id 'com.vanniktech.maven.publish' version '0.34.0' id 'com.diffplug.spotless' version '6.25.0' } -apply plugin: 'java' -apply plugin: 'maven-publish' -apply plugin: 'signing' - group = 'com.dropbox.sign' -archivesBaseName = 'dropbox-sign' version = '1.11-dev' -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 + +base { + archivesName.set('dropbox-sign') +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} repositories { mavenCentral() } -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' } -if (JavaVersion.current().isJava8Compatible()) { - tasks.withType(Javadoc) { - // disable the crazy super-strict doclint tool in Java 8 - //noinspection SpellCheckingInspection +tasks.withType(Javadoc).configureEach { options.addStringOption('Xdoclint:none', '-quiet') - } } task javadocJar(type: Jar) { @@ -68,53 +57,6 @@ artifacts { archives javadocJar, sourcesJar, fatJar } -publishing { - publications { - mavenJava(MavenPublication) { - pom { - name = 'Dropbox Sign' - packaging = 'jar' - // optionally artifactId can be defined here - artifactId = 'dropbox-sign' - description = 'Use the Dropbox SIgn Java SDK to connect your Java app to Dropbox Sign\'s service in microseconds!' - url = 'https://www.hellosign.com/' - - scm { - connection = 'scm:git:git://github.com/hellosign/dropbox-sign-java.git' - developerConnection = 'scm:git:git@github.com:hellosign/dropbox-sign-java.git' - url = 'https://github.com/hellosign/dropbox-sign-java' - } - - licenses { - license { - name = 'MIT License' - url = 'http://www.opensource.org/licenses/mit-license.php' - } - } - - developers { - developer { - name = 'Dropbox Sign API Team' - email = 'apisupport@hellosign.com' - url = 'https://www.hellosign.com' - } - } - } - } - } - repositories { - maven { - def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/" - url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl - credentials { - username findProperty('ossrhUsername') - password findProperty('ossrhPassword') - } - } - } -} - ext { swagger_annotations_version = "1.6.5" jackson_version = "2.17.1" diff --git a/sdks/java-v1/templates/libraries/jersey2/build.gradle.mustache b/sdks/java-v1/templates/libraries/jersey2/build.gradle.mustache index deeb879cb..2339cfe0f 100644 --- a/sdks/java-v1/templates/libraries/jersey2/build.gradle.mustache +++ b/sdks/java-v1/templates/libraries/jersey2/build.gradle.mustache @@ -7,6 +7,7 @@ group = '{{groupId}}' version = '{{artifactVersion}}' {{/useCustomTemplateCode}} +{{^useCustomTemplateCode}} buildscript { repositories { mavenCentral() @@ -14,30 +15,29 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:2.3.+' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' -{{^useCustomTemplateCode}} classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.3.0' -{{/useCustomTemplateCode}} -{{#useCustomTemplateCode}} - classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.25.0' -{{/useCustomTemplateCode}} } } +{{/useCustomTemplateCode}} {{#useCustomTemplateCode}} plugins { + id 'java' id 'com.vanniktech.maven.publish' version '0.34.0' id 'com.diffplug.spotless' version '6.25.0' } -apply plugin: 'java' -apply plugin: 'maven-publish' -apply plugin: 'signing' - group = '{{groupId}}' -archivesBaseName = '{{artifactId}}' version = '{{artifactVersion}}' -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 + +base { + archivesName.set('{{artifactId}}') +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} {{/useCustomTemplateCode}} repositories { @@ -123,16 +123,12 @@ if(hasProperty('target') && target == 'android') { } {{/useCustomTemplateCode}} {{#useCustomTemplateCode}} -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' } -if (JavaVersion.current().isJava8Compatible()) { - tasks.withType(Javadoc) { - // disable the crazy super-strict doclint tool in Java 8 - //noinspection SpellCheckingInspection +tasks.withType(Javadoc).configureEach { options.addStringOption('Xdoclint:none', '-quiet') - } } task javadocJar(type: Jar) { @@ -161,53 +157,6 @@ processResources { artifacts { archives javadocJar, sourcesJar, fatJar } - -publishing { - publications { - mavenJava(MavenPublication) { - pom { - name = 'Dropbox Sign' - packaging = 'jar' - // optionally artifactId can be defined here - artifactId = '{{artifactId}}' - description = 'Use the Dropbox SIgn Java SDK to connect your Java app to Dropbox Sign\'s service in microseconds!' - url = 'https://www.hellosign.com/' - - scm { - connection = '{{scmConnection}}' - developerConnection = '{{scmDeveloperConnection}}' - url = '{{scmUrl}}' - } - - licenses { - license { - name = '{{licenseName}}' - url = 'http://www.opensource.org/licenses/mit-license.php' - } - } - - developers { - developer { - name = '{{developerName}}' - email = '{{developerEmail}}' - url = 'https://www.hellosign.com' - } - } - } - } - } - repositories { - maven { - def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/" - url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl - credentials { - username findProperty('ossrhUsername') - password findProperty('ossrhPassword') - } - } - } -} {{/useCustomTemplateCode}} ext { diff --git a/sdks/java-v2/.github/workflows/close-and-release-repository.yml b/sdks/java-v2/.github/workflows/close-and-release-repository.yml index 4aed1f0c3..8f07b7ed9 100644 --- a/sdks/java-v2/.github/workflows/close-and-release-repository.yml +++ b/sdks/java-v2/.github/workflows/close-and-release-repository.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: repository: - description: 'Manually trigger gradle closeAndReleaseRepository task in case of timeout from previous publishing' + description: 'Manually trigger release in case of timeout from previous publishing' jobs: closeAndReleaseRepository: @@ -20,7 +20,9 @@ jobs: java-version: 11 - name: Publish Release to Maven Central - run: ./gradlew closeAndReleaseRepository --no-daemon --no-parallel --repository ${{ inputs.repository }} + run: ./gradlew publishAndReleaseToMavenCentral --no-daemon --no-parallel --no-configuration-cache --stacktrace env: ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} diff --git a/sdks/java-v2/.github/workflows/github-actions.yml b/sdks/java-v2/.github/workflows/github-actions.yml index 8c8235f57..fb81028a6 100644 --- a/sdks/java-v2/.github/workflows/github-actions.yml +++ b/sdks/java-v2/.github/workflows/github-actions.yml @@ -47,23 +47,26 @@ jobs: distribution: 'zulu' java-version: 11 - - name: Upload Artifacts - run: ./gradlew publishToMavenCentral --no-daemon --no-parallel --no-configuration-cache --stacktrace + - name: Retrieve version + run: echo "PACKAGE_VERSION=$(cat VERSION)" >> $GITHUB_ENV + + - name: Publish to Maven Central + run: ./gradlew publishAndReleaseToMavenCentral --no-daemon --no-parallel --no-configuration-cache --stacktrace + if: "!endsWith(env.PACKAGE_VERSION, '-SNAPSHOT')" env: ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} - - name: Retrieve version - run: echo "PACKAGE_VERSION=$(cat VERSION)" >> $GITHUB_ENV - - - name: Publish Release to Maven Central - run: ./gradlew releaseRepository --no-daemon --no-parallel - if: "!endsWith(env.PACKAGE_VERSION, '-SNAPSHOT')" + - name: Publish Snapshot + run: ./gradlew publishToMavenCentral --no-daemon --no-parallel --no-configuration-cache --stacktrace + if: "endsWith(env.PACKAGE_VERSION, '-SNAPSHOT')" env: ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} # This job runs on merging to "main" branch # Creates a new tag using the value in the VERSION file diff --git a/sdks/java-v2/build.gradle b/sdks/java-v2/build.gradle index 8fc1583c4..070450059 100644 --- a/sdks/java-v2/build.gradle +++ b/sdks/java-v2/build.gradle @@ -1,44 +1,33 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:2.3.+' - classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' - classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.25.0' - } -} plugins { + id 'java' id 'com.vanniktech.maven.publish' version '0.34.0' id 'com.diffplug.spotless' version '6.25.0' } -apply plugin: 'java' -apply plugin: 'maven-publish' -apply plugin: 'signing' - group = 'com.dropbox.sign' -archivesBaseName = 'dropbox-sign' version = '2.7-dev' -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 + +base { + archivesName.set('dropbox-sign') +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} repositories { mavenCentral() } -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' } -if (JavaVersion.current().isJava8Compatible()) { - tasks.withType(Javadoc) { - // disable the crazy super-strict doclint tool in Java 8 - //noinspection SpellCheckingInspection +tasks.withType(Javadoc).configureEach { options.addStringOption('Xdoclint:none', '-quiet') - } } task javadocJar(type: Jar) { @@ -68,53 +57,6 @@ artifacts { archives javadocJar, sourcesJar, fatJar } -publishing { - publications { - mavenJava(MavenPublication) { - pom { - name = 'Dropbox Sign' - packaging = 'jar' - // optionally artifactId can be defined here - artifactId = 'dropbox-sign' - description = 'Use the Dropbox SIgn Java SDK to connect your Java app to Dropbox Sign\'s service in microseconds!' - url = 'https://www.hellosign.com/' - - scm { - connection = 'scm:git:git://github.com/hellosign/dropbox-sign-java.git' - developerConnection = 'scm:git:git@github.com:hellosign/dropbox-sign-java.git' - url = 'https://github.com/hellosign/dropbox-sign-java' - } - - licenses { - license { - name = 'MIT License' - url = 'http://www.opensource.org/licenses/mit-license.php' - } - } - - developers { - developer { - name = 'Dropbox Sign API Team' - email = 'apisupport@hellosign.com' - url = 'https://www.hellosign.com' - } - } - } - } - } - repositories { - maven { - def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/" - url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl - credentials { - username findProperty('ossrhUsername') - password findProperty('ossrhPassword') - } - } - } -} - ext { swagger_annotations_version = "1.6.5" jackson_version = "2.17.1" diff --git a/sdks/java-v2/templates/libraries/jersey3/build.gradle.mustache b/sdks/java-v2/templates/libraries/jersey3/build.gradle.mustache index 8663e4b09..a154937ee 100644 --- a/sdks/java-v2/templates/libraries/jersey3/build.gradle.mustache +++ b/sdks/java-v2/templates/libraries/jersey3/build.gradle.mustache @@ -7,6 +7,7 @@ group = '{{groupId}}' version = '{{artifactVersion}}' {{/useCustomTemplateCode}} +{{^useCustomTemplateCode}} buildscript { repositories { mavenCentral() @@ -14,30 +15,29 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:2.3.+' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' -{{^useCustomTemplateCode}} classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.3.0' -{{/useCustomTemplateCode}} -{{#useCustomTemplateCode}} - classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.25.0' -{{/useCustomTemplateCode}} } } +{{/useCustomTemplateCode}} {{#useCustomTemplateCode}} plugins { + id 'java' id 'com.vanniktech.maven.publish' version '0.34.0' id 'com.diffplug.spotless' version '6.25.0' } -apply plugin: 'java' -apply plugin: 'maven-publish' -apply plugin: 'signing' - group = '{{groupId}}' -archivesBaseName = '{{artifactId}}' version = '{{artifactVersion}}' -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 + +base { + archivesName.set('{{artifactId}}') +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} {{/useCustomTemplateCode}} repositories { @@ -123,16 +123,12 @@ if(hasProperty('target') && target == 'android') { } {{/useCustomTemplateCode}} {{#useCustomTemplateCode}} -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' } -if (JavaVersion.current().isJava8Compatible()) { - tasks.withType(Javadoc) { - // disable the crazy super-strict doclint tool in Java 8 - //noinspection SpellCheckingInspection +tasks.withType(Javadoc).configureEach { options.addStringOption('Xdoclint:none', '-quiet') - } } task javadocJar(type: Jar) { @@ -161,53 +157,6 @@ processResources { artifacts { archives javadocJar, sourcesJar, fatJar } - -publishing { - publications { - mavenJava(MavenPublication) { - pom { - name = 'Dropbox Sign' - packaging = 'jar' - // optionally artifactId can be defined here - artifactId = '{{artifactId}}' - description = 'Use the Dropbox SIgn Java SDK to connect your Java app to Dropbox Sign\'s service in microseconds!' - url = 'https://www.hellosign.com/' - - scm { - connection = '{{scmConnection}}' - developerConnection = '{{scmDeveloperConnection}}' - url = '{{scmUrl}}' - } - - licenses { - license { - name = '{{licenseName}}' - url = 'http://www.opensource.org/licenses/mit-license.php' - } - } - - developers { - developer { - name = '{{developerName}}' - email = '{{developerEmail}}' - url = 'https://www.hellosign.com' - } - } - } - } - } - repositories { - maven { - def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/" - url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl - credentials { - username findProperty('ossrhUsername') - password findProperty('ossrhPassword') - } - } - } -} {{/useCustomTemplateCode}} ext {