Skip to main content
Version: 1.0

SDK Publishing

Publishing the MTN MOMO API SDK is handled automatically by a GitHub Actions CI pipeline using the standard Gradle maven-publish plugin. Pushing a git tag triggers the workflow, which runs tests, signs artifacts, and publishes to Maven Central — no manual steps required.


Repositories

Every tag publishes to both Maven Central and GitHub Packages. A GitHub Release is also created for stable tags.

Version typeRepositoryURL
Stable releaseMaven Centralio.rekast:momo-api-sdk
Stable releaseGitHub Packagesre-kast/android-mtn-momo-api-sdk
SnapshotMaven Central Snapshotshttps://central.sonatype.com/repository/maven-snapshots/
SnapshotGitHub Packagesre-kast/android-mtn-momo-api-sdk

How Publishing Works

The publish pipeline is defined in .github/workflows/publish.yml and is triggered by pushing a tag.

Tag format

TagPublished versionDestination
v1.2.31.2.3Maven Central (release)
v1.2.3-SNAPSHOT1.2.3-SNAPSHOTMaven Central Snapshots

Release path

  1. Gradle builds the AAR, sources JAR, and Dokka javadoc JAR.
  2. Artifacts are GPG-signed using in-memory keys from GitHub secrets.
  3. Everything is written to a local staging directory.
  4. The staging directory is zipped and uploaded to the Maven Central portal API with publishingType=AUTOMATIC.
  5. The same artifacts are published to GitHub Packages.
  6. A GitHub Release is created with the AAR, sources JAR, and POM attached as downloadable assets.

Snapshot path

  1. Artifacts are built, signed, and deployed directly to the Maven Central snapshots repository.
  2. The same artifacts are also published to GitHub Packages.

Pushing a Release

  1. Update the version in android/momo-api-sdk/gradle.properties:

    VERSION_NAME=1.2.3
  2. Commit and push, then create and push a tag:

    git tag v1.2.3
    git push origin v1.2.3

The CI workflow starts automatically. You can monitor it under Actions → Publish to Maven Central in the GitHub repository.

Pushing a snapshot

git tag v1.2.3-SNAPSHOT
git push origin v1.2.3-SNAPSHOT

Snapshot versions are available immediately after the workflow completes. To consume a snapshot, add the Maven Central snapshots repository to your project:

repositories {
maven("https://central.sonatype.com/repository/maven-snapshots/")
}

Required GitHub Secrets

The following secrets must be configured under Settings → Secrets and variables → Actions in the repository:

SecretDescription
MAVEN_CENTRAL_USERNAMEUser token name from central.sonatype.com → Account → User Token
MAVEN_CENTRAL_PASSWORDUser token password from central.sonatype.com → Account → User Token
SIGNING_KEYArmored GPG private key: gpg --export-secret-keys --armor <KEY_ID>
SIGNING_PASSWORDPassphrase for the GPG key

Publishing Locally (Testing)

To verify the publish configuration without uploading to Maven Central, publish to the local staging directory:

cd android
./gradlew :momo-api-sdk:publishReleasePublicationToLocalStagingRepository \
-PVERSION_NAME="1.2.3"

The staged artifacts are written to android/momo-api-sdk/build/staging-deploy/. Inspect them to verify the POM metadata, signatures, and JARs are correct before pushing a tag.

To publish to your local Maven repository (~/.m2/) for use in other local projects:

cd android
./gradlew :momo-api-sdk:publishToMavenLocal -PVERSION_NAME="1.2.3"

Versioning

Follow semantic versioning:

  • Patch (1.2.31.2.4): Bug fixes, no API changes.
  • Minor (1.2.31.3.0): New features, backwards compatible.
  • Major (1.2.32.0.0): Breaking API changes.

Append -SNAPSHOT to a version to publish a development preview (e.g. 1.3.0-SNAPSHOT).


References