Configure these repository secrets in GitHub under
Settings -> Secrets and variables -> Actions -> Repository secrets:
MAVEN_CENTRAL_USERNAME: Maven Central Portal token username.MAVEN_CENTRAL_PASSWORD: Maven Central Portal token password.
Release publishing also needs signing secrets:
SIGNING_KEY_IDSIGNING_PASSWORDGPG_KEY_CONTENTS
Snapshot publishing does not need signing secrets.
Before publishing snapshots, enable snapshots for the io.github.nicolals
namespace in the Maven Central Portal. Sonatype serves snapshots from:
https://central.sonatype.com/repository/maven-snapshots/
Keep the root project version in build.gradle.kts as a -SNAPSHOT version,
for example:
version = "0.3.1-SNAPSHOT"Then run the manual GitHub workflow:
- Open
Actionsin GitHub. - Select
Publish Snapshot. - Click
Run workflow. - Select the branch to publish, usually
main. - Click
Run workflow.
Verify a snapshot upload with module metadata, for example:
curl -fsSL https://central.sonatype.com/repository/maven-snapshots/io/github/nicolals/nostr-core/0.3.1-SNAPSHOT/maven-metadata.xmlConsumers need the snapshot repository explicitly:
repositories {
maven {
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
mavenContent { snapshotsOnly() }
}
mavenCentral()
}Set the root project version to a non-snapshot version and publish with signing
enabled. Locally, set NOSTR_KMP_ENABLE_SIGNING=1, reload direnv, then run:
./gradlew publishToMavenCentral --parallel