@@ -31,14 +31,30 @@ nmcp {
3131}
3232```
3333
34- ### Required Secrets
34+ ### Required Environment Variables
3535
36- The following GitHub secrets must be configured :
36+ For local development and CI/CD, the following environment variables must be set :
3737
38381 . ** MAVEN_CENTRAL_USERNAME** : Username from Central Portal token
39392 . ** MAVEN_CENTRAL_PASSWORD** : Password from Central Portal token
40- 3 . ** SIGNING_KEY** : GPG private key for artifact signing
41- 4 . ** SIGNING_PASSWORD** : GPG key passphrase
40+ 3 . ** GPG_PRIVATE_KEY** : GPG private key for artifact signing (complete PGP block)
41+ 4 . ** GPG_PASSPHRASE** : GPG key passphrase
42+
43+ ### Local Development Setup
44+
45+ Use the provided setup script:
46+ ``` bash
47+ # Source the environment variables
48+ source setup-publishing-env.sh
49+
50+ # Test local publishing first
51+ ./gradlew lib:publishMavenJavaPublicationToMavenLocal
52+
53+ # Publish to Central Portal
54+ ./gradlew lib:publish
55+ # or
56+ ./gradlew lib:publishAllPublicationsToCentralPortal
57+ ```
4258
4359### Central Portal Token Generation
4460
@@ -81,8 +97,29 @@ After publishing with `USER_MANAGED`:
8197- ✅ Updated GitHub Actions workflow
8298- ✅ Fixed JUnit test dependencies (unrelated but needed for build)
8399
100+ ### GPG Signing Configuration
101+
102+ The build now supports both in-memory GPG signing and GPG command-line tool:
103+
104+ ``` gradle
105+ signing {
106+ required { gradle.taskGraph.hasTask("publish") }
107+ def signingKey = System.getenv("GPG_PRIVATE_KEY")
108+ def signingPassword = System.getenv("GPG_PASSPHRASE")
109+
110+ if (signingKey && signingPassword) {
111+ useInMemoryPgpKeys(signingKey, signingPassword) // Preferred for CI/CD
112+ } else {
113+ useGpgCmd() // Fallback to local GPG installation
114+ }
115+ sign publishing.publications.mavenJava
116+ }
117+ ```
118+
84119### Troubleshooting
85120
86- - Ensure all required secrets are configured in GitHub repository settings
87- - Verify GPG signing key is properly formatted (include ` -----BEGIN PGP PRIVATE KEY BLOCK----- ` headers)
121+ - ** GPG Error "finished with non-zero exit value 2"** : Use the provided ` setup-publishing-env.sh ` script to set environment variables for in-memory GPG signing
122+ - Ensure all required environment variables are set before publishing
123+ - Verify GPG private key is properly formatted (include ` -----BEGIN PGP PRIVATE KEY BLOCK----- ` headers)
124+ - Test local publishing first: ` ./gradlew lib:publishMavenJavaPublicationToMavenLocal `
88125- Check Central Portal deployment status at https://central.sonatype.com/
0 commit comments