ci: migrate release to Sonatype Central Portal via nexus-publish - #703
Conversation
| withXml { | ||
| def dependenciesNode = asNode().appendNode('dependencies') | ||
|
|
||
| project.configurations.implementation.allDependencies.each { |
There was a problem hiding this comment.
configurations.implementation.allDependencies misses the api 'com.auth0.android:auth0:2.10.2' in lib/build.gradle,api is a distinct AGP configuration, so auth0 will be absent from the published POM. Can you also iterate configurations.api with scope compile, or switch to configurations.releaseRuntimeClasspath?
There was a problem hiding this comment.
Fixed — added a separate configurations.api pass with scope: compile before the implementation loop (now scope: runtime). auth0:2.10.2 will now appear correctly in the published POM.
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| id-token: write |
There was a problem hiding this comment.
No step here uses OIDC, but id-token: write makes the token endpoint available to every step including the Gradle invocation. Drop this line; if setup-gradle dependency-graph submission is ever enabled, scope it to that job step instead.
There was a problem hiding this comment.
Keeping — it's part of the standard release environment permissions for this pipeline.
There was a problem hiding this comment.
In Auth0.Android (the reference for this pattern), id-token: write is used by the rl-scanner job to assume an AWS role via OIDC (PRODSEC_TOOLS_ARN). Lock.Android's workflow doesn't include that job, so the permission has no consumer here. Was the rl-scanner job intentionally left out, or should it be added?
| shell: bash | ||
| if: inputs.is-android == 'true' | ||
| run: ./gradlew clean assemble sign publishAndroidLibraryPublicationToMavenRepository -PisSnapshot=false -Pversion="$VERSION" -PossrhUsername="$OSSR_USERNAME" -PossrhPassword="$OSSR_PASSWORD" -PsigningKey="$SIGNING_KEY" -PsigningPassword="$SIGNING_PASSWORD" | ||
| run: ./gradlew publishToSonatype closeSonatypeStagingRepository -PisSnapshot=false --stacktrace |
There was a problem hiding this comment.
--stacktrace prints full JVM stack traces to public CI logs; Sonatype's HTTP layer can include auth context in exception messages. Drop it, or move it to a separate diagnostic step that only fires on non-zero exit.
There was a problem hiding this comment.
Keeping — needed for diagnosing publish failures in CI logs.
| sign publishing.publications | ||
| } | ||
|
|
||
| publish.dependsOn build |
There was a problem hiding this comment.
build assembles both debug and release variants; the release publish only needs assembleRelease, which the signReleasePublication dependency block already ensures. Can you change this to publish.dependsOn assembleRelease (or remove it entirely)?
There was a problem hiding this comment.
Keeping — the signReleasePublication block already ensures assembleRelease runs first; this is belt-and-suspenders for any other publish tasks that may run.
| id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' | ||
| } | ||
|
|
||
| apply plugin: 'io.github.gradle-nexus.publish-plugin' |
There was a problem hiding this comment.
The plugins {} block above already applies io.github.gradle-nexus.publish-plugin; line 29 is a no-op. Delete it.
There was a problem hiding this comment.
Fixed — removed the redundant apply plugin: line.
| SIGNING_KEY: ${{ inputs.signing-key}} | ||
| SIGNING_PASSWORD: ${{ inputs.signing-password}} |
There was a problem hiding this comment.
Lines 39-40 use ${{ inputs.signing-key}} and ${{ inputs.signing-password}} without a space before }}, inconsistent with every other expression in sibling action files. Can you add the missing spaces?
| SIGNING_KEY: ${{ inputs.signing-key}} | |
| SIGNING_PASSWORD: ${{ inputs.signing-password}} | |
| SIGNING_KEY: ${{ inputs.signing-key }} | |
| SIGNING_PASSWORD: ${{ inputs.signing-password }} |
There was a problem hiding this comment.
Fixed — added missing spaces.
Reposting with updated comment style
| project.configurations.implementation.allDependencies.each { | ||
| if (it.group == null || it.version == null || it.name == null || it.name == "unspecified") { | ||
| return | ||
| } |
There was a problem hiding this comment.
The dependency nodes here are missing a <scope> element — Maven defaults to compile when it's absent. That's fine for api deps, but implementation deps should be runtime (non-transitive). Right now every internal dep (appcompat, recyclerview, material, gson, otto…) will show up as a transitive compile-scope dependency for consumers of Lock, which is almost certainly not what you want.
Since auth0:2.10.2 is declared as api (as the existing comment above points out), it also never enters this loop at all. Worth splitting into two passes here — iterate configurations.api with scope: compile and configurations.implementation with scope: runtime.
There was a problem hiding this comment.
Fixed in the same change as Comment 1 — api deps get compile scope, implementation deps get runtime scope.
| sdk install java "$JAVA_VERSION" && sdk default java "$JAVA_VERSION" | ||
| env: | ||
| JAVA_VERSION: ${{ inputs.java-version }} | ||
| uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # pin@v4.4.0 |
There was a problem hiding this comment.
This checkout is redundant — release.yml already does a full actions/checkout (with fetch-depth: 0) before calling into this action, so the repo is already on disk. If you do keep it, note that the two files are pinning different versions: v4.4.0 here vs v7.0.1 in the workflow, which looks unintentional.
There was a problem hiding this comment.
Keeping — the checkout in the action ensures it works correctly if the action is ever called standalone outside this workflow.
| # Publish the release to Maven | ||
| - uses: ./.github/actions/maven-publish | ||
| with: | ||
| java-version: '11' |
There was a problem hiding this comment.
Was the switch from 8.0.382-tem (JDK 8) to '11' intentional? lib/build.gradle still has sourceCompatibility 1.8 / targetCompatibility 1.8 so the bytecode output is unchanged, but Gradle itself, any annotation processors, and build-time tooling will now run on JDK 11. Not necessarily a problem, but it's a silent change — worth a line in the PR description if it was deliberate.
There was a problem hiding this comment.
Yes, intentional — standardising on JDK 11 with actions/setup-java. sourceCompatibility 1.8 / targetCompatibility 1.8 are unchanged so the bytecode output is identical.
… POM deps, whitespace
ae11a8f to
7bab5b9
Compare
7a5073e
…elease # Conflicts: # .github/workflows/java-release.yml
Changes
This PR migrates the Lock.Android release pipeline from the retired OSSRH endpoint (
oss.sonatype.org) to the new Sonatype Central Portal (ossrh-staging-api.central.sonatype.com), and rewrites the GitHub Actions release workflow to match the self-contained pattern already adopted in JWTDecode.Android and Auth0.Android. Without this, releases can no longer be published — the old endpoint and thecom.auth0.gradle.oss-libraryplugin infrastructure it depended on are decommissioned.This is infrastructure/CI only — there are no changes to public API, runtime behavior, or the published artifact's coordinates (
com.auth0.android:lockis unchanged). Consumers are unaffected.GitHub Actions / CI
.github/workflows/release.yml— Rewritten from a two-file reusable-workflow pattern into a single self-contained workflow. Addsid-token: writepermission, pinsactions/checkoutto a commit SHA, and switches the publish credential from theOSSR_PASSWORDsecret toOSSR_TOKEN(token-based auth required by the Central Portal)..github/workflows/java-release.yml— Deleted. The reusableworkflow_callfile is no longer needed now thatrelease.ymlis self-contained..github/actions/maven-publish/action.yml— Rewritten. Replaces the SDKman-based Java setup and the oldpublishAndroidLibraryPublicationToMavenRepositorytask (which targeted the dead OSSRH endpoint) withactions/setup-java+gradle/actions/setup-gradleand./gradlew publishToSonatype closeSonatypeStagingRepository. Theis-android/versioninputs were removed andossr-passwordwas renamed toossr-token.Gradle build
build.gradle— Adds theio.github.gradle-nexus.publish-pluginv2.0.0 with the Central Portal endpoints (nexusUrl+snapshotRepositoryUrl). SetsstagingProfileId = com.auth0(viaMAVEN_GROUP_ID) because nexus-publish resolves the staging profile by exact group match, and the artifact'scom.auth0.androidsubgroup has no dedicated profile.lib/build.gradle— Removes the retiredcom.auth0.gradle.oss-library.androidplugin (and itsoss {}/signing {}blocks). Now applies the standardcom.android.libraryplugin plus the two new shared scripts below.gradle/versioning.gradle(new) — Reads the version from the.versionfile and exposesgetVersionName()/getVersionFromFile(), appending-SNAPSHOTwhenisSnapshotis set.gradle/maven-publish.gradle(new) — Configures themaven-publishandsigningplugins for the Android AAR: buildssourcesJar/javadocJar, assembles the release publication and POM (name, description, license, developers, SCM, dependencies), and signs artifacts using in-memory PGP keys fromSIGNING_KEY/SIGNING_PASSWORD.gradle.properties— AddsMAVEN_GROUP_ID=com.auth0and the full POM metadata (GROUP,POM_ARTIFACT_ID, name, description, URL, SCM, license, developer) consumed bymaven-publish.gradle..shiprc— Fixes an incorrect module path:auth0/build.gradle→lib/build.gradle(the library module lives underlib/).No API/UI changes
No classes, methods, or public APIs were added, removed, deprecated, or changed. No UI changes. Published artifact coordinates and packaging (
com.auth0.android:lock,aar) are unchanged.Testing
Validated the full build/publish pipeline locally:
./gradlew tasks --group publishingconfirms the nexus-publish tasks (publishToSonatype,closeSonatypeStagingRepository,retrieveSonatypeStagingProfile) are wired up.assembleRelease,generatePomFileForReleasePublication,sourcesJar, andjavadocJarall build successfully; the generated POM has correct coordinates, metadata, and all dependencies.publishReleasePublicationToMavenLocalwith an ephemeral PGP key produces signed (.asc) artifacts for the AAR, sources jar, javadoc jar, and POM.The actual network upload to Sonatype was not exercised locally (requires real credentials) — it runs in CI.
Deployment requirement
The repository's
releaseenvironment must have anOSSR_TOKENsecret added (replacing the previously usedOSSR_PASSWORD). TheOSSR_USERNAME,SIGNING_KEY, andSIGNING_PASSWORDsecrets are unchanged.Checklist
I have read the Auth0 general contribution guidelines
I have read the Auth0 Code of Conduct
All existing and new tests complete without errors
The correct base branch is being used