diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 032bb3c..8a32311 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: matrix: os: [ubuntu-latest] java-distribution: [adopt] - java-version: [8] + java-version: [11] dockcross-only: [ "android-arm", @@ -85,7 +85,7 @@ jobs: matrix: os: [macos-latest] java-distribution: [adopt] - java-version: [8] + java-version: [11] steps: - uses: actions/checkout@v4 @@ -193,13 +193,13 @@ jobs: - name: Publish to Sonatype OSSRH (Maven Central) env: - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - OSSRH_STAGING_PROFILE_ID: ${{ secrets.OSSRH_STAGING_PROFILE_ID }} - run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -Ph3GithubArtifactsUse=true -Ph3GithubArtifactsByRun=true + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }} + # OSSRH_STAGING_PROFILE_ID: ${{ secrets.OSSRH_STAGING_PROFILE_ID }} + run: ./gradlew publishAndReleaseToMavenCentral -Ph3GithubArtifactsUse=true -Ph3GithubArtifactsByRun=true - name: Create GitHub Release (with changelog notes) # This uses an action to create a release on GitHub diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 31aa213..bec5c21 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: matrix: os: [ubuntu-latest] java-distribution: [adopt] - java-version: [8, 11, 17, 21, 22] + java-version: [11, 17, 21, 22] dockcross-only: ["android-arm", "android-arm64", "linux-arm64", "linux-armv5", "linux-armv7", "linux-s390x", "linux-ppc64le", "linux-x64", "linux-x86", "windows-static-x64", "windows-static-x86"] steps: @@ -59,7 +59,7 @@ jobs: - uses: actions/upload-artifact@v4 name: Upload artifacts - if: ${{ matrix.java-version == 8 }} + if: ${{ matrix.java-version == 11 }} with: name: docker-built-shared-objects-${{ matrix.dockcross-only }} path: | @@ -118,7 +118,7 @@ jobs: # TODO: Windows pinned back os: [macos-latest, windows-2022] java-distribution: [adopt] - java-version: [8, 11, 17, 21, 22] + java-version: [11, 17, 21, 22] steps: - uses: actions/checkout@v4 @@ -149,7 +149,7 @@ jobs: - uses: actions/upload-artifact@v4 name: Upload Mac OS Artifacts - if: ${{ matrix.os == 'macos-latest' && matrix.java-version == 8 }} + if: ${{ matrix.os == 'macos-latest' && matrix.java-version == 11 }} with: name: macos-built-shared-objects path: src/main/resources/*/*.dylib @@ -206,7 +206,7 @@ jobs: matrix: os: [ubuntu-latest] java-distribution: [adopt] - java-version: [8] + java-version: [11] steps: - uses: actions/checkout@v4 diff --git a/build.gradle b/build.gradle index 5952c9c..6509386 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,6 @@ +import com.vanniktech.maven.publish.JavaLibrary +import com.vanniktech.maven.publish.JavadocJar + buildscript { repositories { mavenCentral() @@ -15,7 +18,7 @@ plugins { // TODO: Requires Java 11 // id 'com.diffplug.spotless' version '6.25.0' id 'com.github.nbaztec.coveralls-jacoco' version '1.2.20' - id 'io.github.gradle-nexus.publish-plugin' version '1.3.0' + id 'com.vanniktech.maven.publish' version '0.34.0' } group = 'com.uber' @@ -117,75 +120,46 @@ sourcesJar { dependsOn buildH3 } -publishing { - publications { - mavenJava(MavenPublication) { - from components.java - pom { - name = 'h3' - url = 'https://github.com/uber/h3-java' - description = project.description - licenses { - license { - name = 'Apache License, Version 2.0' - url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' - distribution = 'repo' - } - } - organization { - name = 'Uber Open Source' - url = 'https://github.com/uber/' - } - scm { - connection = 'scm:git:git://github.com/uber/h3-java.git' - developerConnection = 'scm:git:ssh://git@github.com/uber/h3-java.git' - url = 'http://github.com/uber/h3-java/tree/master' - } - developers { - developer { - id = 'isaacbrodsky' - name = 'Isaac Brodsky' - email = 'isaac@isaacbrodsky.com' - organization = 'Uber Technologies, Inc.' - organizationUrl = 'https://github.com/uber/' - } - } - } - } - } +mavenPublishing { + coordinates(project.group, "h3", project.version) - // 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 = project.findProperty('ossrhUsername') ?: '' - // password = project.findProperty('ossrhPassword') ?: '' - // } - // } - // } -} - -signing { - // Use in-memory PGP signing keys from environment variables - useInMemoryPgpKeys( - System.getenv("SIGNING_KEY_ID"), // PGP key ID (short format) – optional, can be null - System.getenv("SIGNING_KEY"), // PGP secret key (ASCII-armored, e.g. base64-encoded) - System.getenv("SIGNING_PASSWORD") // PGP key passphrase - ) - sign(publishing.publications) // Sign all publications -} - -nexusPublishing { - repositories { - sonatype { - // Performance optimization, not needed: - // stagingProfileId.set(System.getenv("OSSRH_STAGING_PROFILE_ID")) - username.set(System.getenv("OSSRH_USERNAME")) - password.set(System.getenv("OSSRH_PASSWORD")) - nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/")) - snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/")) - } + pom { + name = "h3" + description = project.description + url = "https://github.com/uber/h3-java" + licenses { + license { + name = "The Apache License, Version 2.0" + url = "http://www.apache.org/licenses/LICENSE-2.0.txt" + distribution = "http://www.apache.org/licenses/LICENSE-2.0.txt" + } + } + organization { + name = 'Uber Open Source' + url = 'https://github.com/uber/' + } + developers { + developer { + id = "isaacbrodsky" + name = "Isaac Brodsky" + email = "isaac@isaacbrodsky.com" + } } + scm { + url = "http://github.com/uber/h3-java/tree/master" + connection = "scm:git:git://github.com/uber/h3-java.git" + developerConnection = "scm:git:ssh://git@github.com/uber/h3-java.git" + } + } + + // the first parameter configures the -javadoc artifact, possible values: + // - `JavadocJar.None()` don't publish this artifact + // - `JavadocJar.Empty()` publish an empty jar + // - `JavadocJar.Javadoc()` to publish standard javadocs + // the second whether to publish a sources jar + configure(new JavaLibrary(new JavadocJar.Javadoc(), true)) + + publishToMavenCentral() + + signAllPublications() }