Got publishing to work and updated the docs for it.

This commit is contained in:
Rob Greene
2025-07-31 13:36:25 -05:00
parent da0fdcc659
commit 3f673fabbb
2 changed files with 94 additions and 59 deletions
+43 -10
View File
@@ -2,26 +2,40 @@
## GPG Keys
Summary of commands for GPG2 keys preparation...
> Note historically, it was `gpg2` but appears to now be `gpg` (which is v2 by default).
Summary of commands for GPG 2.x keys preparation...
Generate key:
```bash
$ gpg2 --gen-key
$ gpg --gen-key
```
Publish key on public key server:
```bash
$ gpg2 --list-keys
$ gpg2 --list-secret-keys
$ gpg2 --keyserver hkp://pool.sks-keyservers.net --send-keys <key-id>
$ gpg --list-keys
$ gpg --list-secret-keys
$ gpg --keyserver hkp://pool.sks-keyservers.net --send-keys <key-id>
```
Extract secret key for the Gradle signing plugin:
```bash
$ gpg2 --export-secret-keys > secring.gpg
$ gpg --export-secret-keys > secring.gpg
```
## Grande config file
```bash
$ cat ~/.gradle/gradle.properties
ossrhUsername=<generated user>
ossrhPassword=<generated password>
signing.keyId=<exported key id - last 8 characters>
signing.password=<passphrase>
signing.secretKeyRingFile=/home/rob/.gnupg/secring.gpg
```
## Gradle build and publish to Central Repository
@@ -55,7 +69,25 @@ BUILD SUCCESSFUL in 16s
93 actionable tasks: 93 executed
```
Then follow "releasing the deployment" below.
As of 2025, the publishing in Maven Central has moved/changed. The plugin does work, but a special id needs to be generated.
Also note that after publishing, we have to tell Maven Central we're done. That can be done with the following curl (which takes some time).
```bash
$ curl -v -X POST https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/net.sf.applecommander --user "<user>:<password>"
> POST /manual/upload/defaultRepository/net.sf.applecommander HTTP/2
> Host: ossrh-staging-api.central.sonatype.com
> Authorization: Basic UndSNzlOOmxYSjJGWmlQMkxXNHNrS1NNeUoxeWhDaGFSV0tpdXJpNw==
> User-Agent: curl/8.9.1
> Accept: */*
>
* Request completely sent off
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
< HTTP/2 200
< date: Thu, 31 Jul 2025 18:27:21 GMT
< content-length: 0
<
* Connection #0 to host ossrh-staging-api.central.sonatype.com left intact
```
## Tag and publish on GitHub
@@ -63,7 +95,8 @@ Just a reminder!
# References
* http://central.sonatype.org/pages/gradle.html (NOTE: Documentation is out of date)
* http://central.sonatype.org/pages/releasing-the-deployment.html
* https://docs.gradle.org/current/userguide/publishing_maven.html
* https://central.sonatype.com/publishing/deployments to check on publishing status
* https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#ensuring-deployment-visibility-in-the-central-publisher-portal
* https://central.sonatype.org/publish/generate-portal-token/
* https://docs.gradle.org/8.13/userguide/signing_plugin.html#sec:signatory_credentials
* For all the other little pieces, Google is your friend. ;-)
+51 -49
View File
@@ -52,52 +52,54 @@ tasks.register('sourcesJar', Jar) {
from sourceSets.main.allSource
}
//publishing {
// publications {
// mavenJava(MavenPublication) {
// from components.java
// artifact sourcesJar
// artifact javadocJar
// pom {
// groupId = "net.sf.applecommander"
// artifactId = "AppleCommander"
// name = 'AppleCommander'
// description = 'AppleCommander is a general utility for Apple II disk images.'
// url = 'https://applecommander.github.io/'
// licenses {
// license {
// name = 'The GNU General Public License (GPL) Version 2, June 1991'
// url = 'https://www.gnu.org/licenses/gpl-2.0.html'
// }
// }
// developers {
// developer {
// id = 'robgreene'
// name = 'Rob Greene'
// email = 'robgreene@gmail.com'
// }
// }
// scm {
// connection = 'scm:git:https://github.com/AppleCommander/AppleCommander.git'
// developerConnection = 'scm:git:git@github.com:AppleCommander/AppleCommander.git'
// url = 'https://github.com/AppleCommander/AppleCommander'
// }
// }
// repositories {
// maven {
// def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
// def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
// url = isSnapshotVersion ? snapshotsRepoUrl : releasesRepoUrl
// credentials {
// username = findProperty('ossrhUsername')
// password = findProperty('ossrhPassword')
// }
// }
// }
// }
// }
//}
//
//signing {
// sign publishing.publications.mavenJava
//}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = "net.sf.applecommander"
artifactId = "AppleCommander"
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name = 'AppleCommander'
description = 'AppleCommander is a general utility for Apple II disk images.'
url = 'https://applecommander.github.io/'
licenses {
license {
name = 'The GNU General Public License (GPL) Version 2, June 1991'
url = 'https://www.gnu.org/licenses/gpl-2.0.html'
}
}
developers {
developer {
id = 'robgreene'
name = 'Rob Greene'
email = 'robgreene@gmail.com'
}
}
scm {
connection = 'scm:git:https://github.com/AppleCommander/AppleCommander.git'
developerConnection = 'scm:git:git@github.com:AppleCommander/AppleCommander.git'
url = 'https://github.com/AppleCommander/AppleCommander'
}
}
repositories {
maven {
def releasesRepoUrl = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://ossrh-staging-api.central.sonatype.com/content/repositories/snapshots/"
url = isSnapshotVersion ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = findProperty('ossrhUsername')
password = findProperty('ossrhPassword')
}
}
}
}
}
}
signing {
sign publishing.publications.mavenJava
}