Add Android Maven Central publishing channel (com.contentful.java:optimization-android)#299
Merged
Alex Freas (akfreas) merged 17 commits intoMay 30, 2026
Conversation
…lone Android builds
…h, Central Portal)
…9-create-android-distribution-channel
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
Charles Hudson (phobetron)
previously approved these changes
May 30, 2026
Charles Hudson (phobetron)
previously approved these changes
May 30, 2026
Charles Hudson (phobetron)
approved these changes
May 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Maven Central publishing channel for the Android library, mirroring the Swift/SPM setup (#292). Consumers add one line —
implementation("com.contentful.java:optimization-android:<version>")— instead of a local Gradle composite-include.Coordinate:
com.contentful.java:optimization-android— reuses Contentful's existing, already-verified Maven Central namespace (com.contentful.java, which holdsjava-sdk/cma-sdk), so no new namespace registration or DNS verification is needed. Host is the Sonatype Central Portal via thecom.vanniktech.maven.publishplugin. The release runs in parallel with the Swift package off the samerelease: publishedevent.Changes
settings.gradle.ktsnow pins plugin versions (AGP 8.7.3 / Kotlin 2.3.20 / vanniktech 0.30.0) and fixes the invaliddependencyResolution {}block →dependencyResolutionManagement {}, so the module builds on its own (not only inside the demo's composite build). Adds a pinned Gradle wrapper (8.10.2) +gradlew.bat.build.gradle.ktsgetsgroup/version(from-Pcontentful.optimization.version/RELEASE_VERSION), the vanniktechmavenPublishing {}block (single release variant + sources + javadoc), Central Portal target, and a full POM. Signing is applied only when a key is present, so local smoke tests need no GPG..github/workflows/publish-android.yaml: on av*release (orworkflow_dispatch), builds the JS bridge, thenpublishAndReleaseToMavenCentral. Credentials come from GitHub Actions secrets (see below).android_librarypath filter +android-library-buildjob runspublishToMavenLocalon PRs touching the module, catching packaging breaks (no Central access needed).scripts/setup-maven-central-credential.shprovisions and self-verifies everything (details for the runner below).optimization-android-demo) — switched from the composite-include to consuming the Maven artifact, reflecting how a real developer integrates the SDK.Verification (done locally)
./gradlew publishToMavenLocalproduces the full artifact set (.aar+-sources.jar+-javadoc.jar+.pom+.module); the AAR bundles the JS bridge and the POM declares deps (incl. the newrecyclerviewfrom Android XML Views reference implementation + shared E2E matrix #286).com.contentful.java:optimization-android:0.0.0-localfrommavenLocal()), with the bridge ending up in the APK — proving the package works in a real app.vanniktech 0.30.0is pinned deliberately: 0.36.0 requires AGP 8.13+, which this repo isn't on yet.Maven Central publishing needs five GitHub Actions secrets on
contentful/optimization. They're not set yet (pending IT granting Central Portal access). A maintainer must run the provisioning script once:Who can run it: someone who (a) has been granted access to the Contentful Central Portal account that owns the
com.contentful.javanamespace, and (b) can set Actions secrets oncontentful/optimization(admin, or a role that includessecrets).Prerequisites on your machine:
gh(logged in viagh auth login),gpg,curl,base64.What it does (and prompts you for):
Contentful Optimization <mobile@contentful.com>) and publishes its public half tokeyserver.ubuntu.comandkeys.openpgp.org(Maven Central validates signatures against these).gh secret set:MAVEN_CENTRAL_USERNAME,MAVEN_CENTRAL_PASSWORD(the user token)MAVEN_SIGNING_KEY(armored private key),MAVEN_SIGNING_KEY_ID,MAVEN_SIGNING_PASSWORDAfter the secrets are set — first release
workflow_dispatch), or cut av*GitHub Release (which fires both the Swift and Android publish workflows).com.contentful.java:optimization-android:<version>appears on the Central Portal and resolves frommavenCentral().optimization-android-demo, dropmavenLocal()fromsettings.gradle.ktsand bump the dependency from0.0.0-localto the released version.🤖 Generated with Claude Code