Publishing extension has been preconfigured for deployment to Maven Central repository via OSSRH. A jar file with
documentation (javadoc.jar
) is created with Dokka. In order to sigh the publication, you have to provide one of the
following sets of environmental variables:
-
- SIGN_KEY_ID - The public key ID (The last 8 symbols of the keyId)
- SIGN_KEY - The secret (private) key
- SIGN_KEY_PASSPHRASE - The passphrase used to protect your private key
-
- SIGN_KEY - The secret (private) key
- SIGN_KEY_PASSPHRASE - The passphrase used to protect your private key
For more information about signing the publication, please refer to the Signing Plugin readme.
OSSRH credentials also have to be provided via
- SONATYPE_USER
- SONATYPE_PASSWORD
environmental variables.
Please follow the OSSRH guide for the detailed steps on how to get the credentials and claim the group name.
Finally, the publication can be started with ./gradlew publish
command
gpg --list-keys --keyid-format short
export SIGN_KEY_B64=$(gpg --armor --export-secret-keys B6083312 | base64)
export SIGN_KEY=$(gpg --armor --export-secret-keys B6083312)
export SIGN_KEY_ID=B6083312
export SIGN_KEY_PASSPHRASE=pass
export SONATYPE_USER=user
export SONATYPE_PASSWORD=password
./gradlew publish
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
publishing {
repositories {
maven {
name = "OSSRH"
if (isRemoteRepositoryEnabled) {
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_PASSWORD")
}
} else {
setUrl("$buildDir/repo")
}
}
}
}