|
| 1 | +# Maven Central Publishing Setup - Summary |
| 2 | + |
| 3 | +This project has been successfully configured for publishing to Maven Central. Here's a summary of all the changes made: |
| 4 | + |
| 5 | +## ✅ Configuration Files Added/Modified |
| 6 | + |
| 7 | +### 1. `gradle.properties` (NEW) |
| 8 | +- Contains all publishing configuration properties |
| 9 | +- Includes signing configuration options |
| 10 | +- Provides project metadata (description, URLs, license, etc.) |
| 11 | +- Supports both local file and environment variable configuration |
| 12 | + |
| 13 | +### 2. `build.gradle.kts` (UPDATED) |
| 14 | +- Added `io.github.gradle-nexus.publish-plugin` for automated publishing |
| 15 | +- Enhanced publishing configuration with proper POM metadata |
| 16 | +- Added signing configuration with flexible GPG options |
| 17 | +- Added Maven Central (OSSRH) repository configuration |
| 18 | +- Added validation tasks for publishing requirements |
| 19 | +- Created helper tasks: `publishToMavenCentral` and `publishAndRelease` |
| 20 | + |
| 21 | +### 3. `PUBLISHING.md` (NEW) |
| 22 | +- Comprehensive guide for Maven Central publishing |
| 23 | +- Step-by-step setup instructions |
| 24 | +- Configuration examples for different scenarios |
| 25 | +- Troubleshooting guide |
| 26 | +- Security best practices |
| 27 | + |
| 28 | +### 4. `README.md` (UPDATED) |
| 29 | +- Added installation instructions for Maven/Gradle users |
| 30 | +- Includes dependency coordinates for the library |
| 31 | + |
| 32 | +### 5. `.github/workflows/publish.yml` (UPDATED) |
| 33 | +- Enhanced to support Maven Central publishing |
| 34 | +- Added GPG signing support for CI/CD |
| 35 | +- Supports both staging and automatic release workflows |
| 36 | +- Creates GitHub releases for tagged versions |
| 37 | + |
| 38 | +## ✅ Features Implemented |
| 39 | + |
| 40 | +### Publishing Configuration |
| 41 | +- **Maven Central**: Full OSSRH integration with staging and release |
| 42 | +- **GitHub Packages**: Existing functionality preserved |
| 43 | +- **Local Repository**: For testing purposes |
| 44 | +- **Flexible Signing**: Support for both GPG agent and key ring files |
| 45 | + |
| 46 | +### Validation & Safety |
| 47 | +- **Configuration Validation**: `validatePublishingConfiguration` task |
| 48 | +- **Proper POM Metadata**: All required fields for Maven Central |
| 49 | +- **Dependency Management**: Correct scoping of API vs implementation dependencies |
| 50 | + |
| 51 | +### Automation |
| 52 | +- **GitHub Actions**: Automated publishing on tags and manual dispatch |
| 53 | +- **Version Management**: Git-based versioning integrated with publishing |
| 54 | +- **Release Creation**: Automatic GitHub releases with artifacts |
| 55 | + |
| 56 | +## 🔧 Required Setup (Before Publishing) |
| 57 | + |
| 58 | +To publish to Maven Central, you need: |
| 59 | + |
| 60 | +### 1. Sonatype OSSRH Account |
| 61 | +```bash |
| 62 | +# Create account at: https://issues.sonatype.org |
| 63 | +# Request access to group ID: dev.dbos |
| 64 | +``` |
| 65 | + |
| 66 | +### 2. GPG Signing Key |
| 67 | +```bash |
| 68 | +# Generate key |
| 69 | +gpg --gen-key |
| 70 | + |
| 71 | +# Upload to keyserver |
| 72 | +gpg --keyserver keyserver.ubuntu.com --send-keys YOUR_KEY_ID |
| 73 | +``` |
| 74 | + |
| 75 | +### 3. Configuration |
| 76 | +Add to `~/.gradle/gradle.properties`: |
| 77 | +```properties |
| 78 | +ossrhUsername=your-username |
| 79 | +ossrhPassword=your-password |
| 80 | +signing.gnupg.executable=gpg |
| 81 | +``` |
| 82 | + |
| 83 | +Or use environment variables: |
| 84 | +```bash |
| 85 | +export OSSRH_USERNAME=your-username |
| 86 | +export OSSRH_PASSWORD=your-password |
| 87 | +``` |
| 88 | + |
| 89 | +## 🚀 Publishing Commands |
| 90 | + |
| 91 | +### Test Publishing Configuration |
| 92 | +```bash |
| 93 | +./gradlew validatePublishingConfiguration |
| 94 | +``` |
| 95 | + |
| 96 | +### Build and Generate Artifacts |
| 97 | +```bash |
| 98 | +./gradlew clean build |
| 99 | +``` |
| 100 | + |
| 101 | +### Publish to Staging (Manual Release Required) |
| 102 | +```bash |
| 103 | +./gradlew publishToMavenCentral |
| 104 | +``` |
| 105 | + |
| 106 | +### Publish and Auto-Release |
| 107 | +```bash |
| 108 | +./gradlew publishAndRelease |
| 109 | +``` |
| 110 | + |
| 111 | +### GitHub Actions Automated Publishing |
| 112 | +- **Push to tag `v*`**: Automatically publishes and releases to Maven Central |
| 113 | +- **Release branch**: Publishes to staging (manual release required) |
| 114 | +- **Manual dispatch**: Optional Maven Central publishing |
| 115 | + |
| 116 | +## 📋 Maven Central Requirements ✅ |
| 117 | + |
| 118 | +All Maven Central requirements are satisfied: |
| 119 | + |
| 120 | +- ✅ **Group ID**: `dev.dbos` (needs Sonatype approval) |
| 121 | +- ✅ **Artifact ID**: `transact` |
| 122 | +- ✅ **Version**: Semantic versioning with git-based calculation |
| 123 | +- ✅ **Name**: "DBOS Transact" |
| 124 | +- ✅ **Description**: "DBOS Transact: Lightweight Durable Workflows for Java" |
| 125 | +- ✅ **URL**: GitHub repository URL |
| 126 | +- ✅ **License**: MIT License with URL |
| 127 | +- ✅ **Developer Info**: Complete developer information |
| 128 | +- ✅ **SCM Info**: Git repository information |
| 129 | +- ✅ **Sources JAR**: Automatically generated |
| 130 | +- ✅ **Javadoc JAR**: Automatically generated |
| 131 | +- ✅ **GPG Signatures**: Configured for all artifacts |
| 132 | + |
| 133 | +## 📦 Generated Artifacts |
| 134 | + |
| 135 | +The build generates the following artifacts for publishing: |
| 136 | +- `transact-{version}.jar` (Main library) |
| 137 | +- `transact-{version}-sources.jar` (Source code) |
| 138 | +- `transact-{version}-javadoc.jar` (API documentation) |
| 139 | +- `transact-{version}.pom` (Maven metadata) |
| 140 | +- All artifacts signed with GPG (when configured) |
| 141 | + |
| 142 | +## 🔍 Verification |
| 143 | + |
| 144 | +Check that everything is working: |
| 145 | + |
| 146 | +```bash |
| 147 | +# Validate configuration |
| 148 | +./gradlew validatePublishingConfiguration |
| 149 | + |
| 150 | +# Generate POM for review |
| 151 | +./gradlew generatePomFileForMavenJavaPublication |
| 152 | +cat build/publications/mavenJava/pom-default.xml |
| 153 | + |
| 154 | +# Build all artifacts |
| 155 | +./gradlew clean build publishToMavenLocal |
| 156 | +ls -la ~/.m2/repository/dev/dbos/transact/ |
| 157 | +``` |
| 158 | + |
| 159 | +## 🎯 Next Steps |
| 160 | + |
| 161 | +1. **Setup Sonatype Account**: Create OSSRH account and request `dev.dbos` group access |
| 162 | +2. **Configure GPG**: Generate signing key and configure Gradle |
| 163 | +3. **Test Publishing**: Use staging repository first |
| 164 | +4. **Release Process**: Create release tags for production publishing |
| 165 | +5. **Documentation**: Update project documentation with Maven coordinates |
| 166 | + |
| 167 | +The project is now fully prepared for Maven Central publishing! 🎉 |
0 commit comments