|
| 1 | +#Publishing Guide |
| 2 | + |
| 3 | +This guide explains how to publish individual modules or all modules to Maven Central. |
| 4 | + |
| 5 | +##Prerequisites |
| 6 | + |
| 7 | +1.**Signing Key**: Ensure you have a valid PGP signing key configured in`local.properties`: |
| 8 | +```properties |
| 9 | +signing.keyId=YOUR_KEY_ID |
| 10 | +signing.password=YOUR_KEY_PASSPHRASE |
| 11 | +signing.key=signing.key.txt |
| 12 | +``` |
| 13 | + |
| 14 | +2.**Maven Central Credentials**: Configure your credentials in`local.properties`: |
| 15 | +```properties |
| 16 | +centralPortalUsername=YOUR_USERNAME |
| 17 | +centralPortalPassword=YOUR_PASSWORD |
| 18 | +``` |
| 19 | + |
| 20 | +##Publishing Individual Modules |
| 21 | + |
| 22 | +###Method 1: Using the Batch Script (Windows) |
| 23 | + |
| 24 | +The easiest way to publish a single module: |
| 25 | + |
| 26 | +```bash |
| 27 | +# Publish a specific module |
| 28 | +publish.bat analytiks-appsflyer |
| 29 | + |
| 30 | +# List all available modules |
| 31 | +publish.bat list |
| 32 | + |
| 33 | +# Publish all addon modules |
| 34 | +publish.bat all-addons |
| 35 | + |
| 36 | +# Publish core modules |
| 37 | +publish.bat core |
| 38 | +``` |
| 39 | + |
| 40 | +###Method 2: Using Gradle Directly |
| 41 | + |
| 42 | +```bash |
| 43 | +# Publish a specific module |
| 44 | +./gradlew publishModule -PmoduleName=analytiks-appsflyer |
| 45 | + |
| 46 | +# List all available modules |
| 47 | +./gradlew listModules |
| 48 | + |
| 49 | +# Publish all addon modules |
| 50 | +./gradlew publishAllAddons |
| 51 | + |
| 52 | +# Publish core modules |
| 53 | +./gradlew publishCore |
| 54 | +``` |
| 55 | + |
| 56 | +##Available Modules |
| 57 | + |
| 58 | +###Core Modules |
| 59 | +-`analytiks-core` - Core analytics functionality |
| 60 | +-`analytiks` - Main analytics library |
| 61 | + |
| 62 | +###Addon Modules |
| 63 | +-`analytiks-appsflyer` - AppsFlyer integration |
| 64 | +-`analytiks-amplitude` - Amplitude integration |
| 65 | +-`analytiks-appvisor` - AppVisor integration |
| 66 | +-`analytiks-azureinsight` - Azure Application Insights integration |
| 67 | +-`analytiks-googleanalytics` - Google Analytics integration |
| 68 | +-`analytiks-mixpanel` - Mixpanel integration |
| 69 | +-`analytiks-segment` - Segment integration |
| 70 | +-`analytiks-timber` - Timber logging integration |
| 71 | + |
| 72 | +##Publishing Workflow |
| 73 | + |
| 74 | +###Publishing a Single Module |
| 75 | + |
| 76 | +1.**Build and test the module**: |
| 77 | +```bash |
| 78 | + ./gradlew :addon:analytiks-appsflyer:build |
| 79 | + ./gradlew :addon:analytiks-appsflyer:test |
| 80 | +``` |
| 81 | + |
| 82 | +2.**Publish the module**: |
| 83 | +```bash |
| 84 | + publish.bat analytiks-appsflyer |
| 85 | +``` |
| 86 | + |
| 87 | + Or using Gradle: |
| 88 | +```bash |
| 89 | + ./gradlew publishModule -PmoduleName=analytiks-appsflyer |
| 90 | +``` |
| 91 | + |
| 92 | +3.**Verify on Maven Central**: |
| 93 | +- Go tohttps://central.sonatype.com/ |
| 94 | +- Search for`io.github.aminekarimii:analytiks-appsflyer` |
| 95 | +- Check that version 1.1.0 is available |
| 96 | + |
| 97 | +###Publishing All Addon Modules |
| 98 | + |
| 99 | +If you want to publish all addon modules at once: |
| 100 | + |
| 101 | +```bash |
| 102 | +publish.bat all-addons |
| 103 | +``` |
| 104 | + |
| 105 | +Or: |
| 106 | + |
| 107 | +```bash |
| 108 | +./gradlew publishAllAddons |
| 109 | +``` |
| 110 | + |
| 111 | +###Publishing Core Modules |
| 112 | + |
| 113 | +To publish the core modules (analytiks-core and analytiks): |
| 114 | + |
| 115 | +```bash |
| 116 | +publish.bat core |
| 117 | +``` |
| 118 | + |
| 119 | +Or: |
| 120 | + |
| 121 | +```bash |
| 122 | +./gradlew publishCore |
| 123 | +``` |
| 124 | + |
| 125 | +##Troubleshooting |
| 126 | + |
| 127 | +###Issue: "Module not found" |
| 128 | + |
| 129 | +Make sure you're using the correct module name. Run`publish.bat list` to see all available modules. |
| 130 | + |
| 131 | +###Issue: "Signing failed" |
| 132 | + |
| 133 | +Check that: |
| 134 | +1. Your`signing.password` in`local.properties` is the correct PGP key passphrase (not the key ID or fingerprint) |
| 135 | +2. The`signing.key.txt` file exists and contains your PGP private key |
| 136 | +3. The`signing.keyId` matches your key (last 8 characters of the fingerprint) |
| 137 | + |
| 138 | +###Issue: "Authentication failed" |
| 139 | + |
| 140 | +Verify your Maven Central credentials in`local.properties`: |
| 141 | +-`centralPortalUsername` should be your Central Portal username |
| 142 | +-`centralPortalPassword` should be your Central Portal password (or token) |
| 143 | + |
| 144 | +###Issue: "Duplicate artifacts" |
| 145 | + |
| 146 | +This usually happens when publishing multiple modules simultaneously. Use the single module publishing approach instead: |
| 147 | + |
| 148 | +```bash |
| 149 | +# Instead of: |
| 150 | +./gradlew build publishToSonatype closeAndReleaseStagingRepositories |
| 151 | + |
| 152 | +# Do: |
| 153 | +publish.bat analytiks-appsflyer |
| 154 | +publish.bat analytiks-amplitude |
| 155 | +# etc. |
| 156 | +``` |
| 157 | + |
| 158 | +###Issue: "Validation failed" |
| 159 | + |
| 160 | +Some modules may have validation errors. To see which modules are failing: |
| 161 | + |
| 162 | +1. Check the Maven Central validation report |
| 163 | +2. Fix the issues in the failing modules |
| 164 | +3. Publish only the modules that pass validation |
| 165 | + |
| 166 | +##Publishing Strategy |
| 167 | + |
| 168 | +###Recommended Approach |
| 169 | + |
| 170 | +1.**Publish core modules first**: |
| 171 | +```bash |
| 172 | + publish.bat core |
| 173 | +``` |
| 174 | + |
| 175 | +2.**Publish addon modules one by one**: |
| 176 | +```bash |
| 177 | + publish.bat analytiks-appsflyer |
| 178 | + publish.bat analytiks-amplitude |
| 179 | +# etc. |
| 180 | +``` |
| 181 | + |
| 182 | +3.**Or publish only the modules you need**: |
| 183 | +```bash |
| 184 | + publish.bat analytiks-appsflyer |
| 185 | +``` |
| 186 | + |
| 187 | +###Why Publish Individually? |
| 188 | + |
| 189 | +-**Avoid validation errors**: Some modules may have issues that prevent publishing |
| 190 | +-**Faster feedback**: You know immediately if a specific module fails |
| 191 | +-**Easier debugging**: Errors are isolated to a single module |
| 192 | +-**Selective publishing**: Only publish the modules you've updated |
| 193 | + |
| 194 | +##Version Management |
| 195 | + |
| 196 | +The version is defined in`gradle.properties`: |
| 197 | + |
| 198 | +```properties |
| 199 | +PUBLISH_VERSION=1.1.0 |
| 200 | +``` |
| 201 | + |
| 202 | +To publish a new version: |
| 203 | + |
| 204 | +1. Update`PUBLISH_VERSION` in`gradle.properties` |
| 205 | +2. Commit the change |
| 206 | +3. Publish the modules |
| 207 | +4. Tag the release in Git: |
| 208 | +```bash |
| 209 | + git tag -a v1.1.0 -m"Release version 1.1.0" |
| 210 | + git push origin v1.1.0 |
| 211 | +``` |
| 212 | + |
| 213 | +##CI/CD Integration |
| 214 | + |
| 215 | +You can integrate the publishing scripts into your CI/CD pipeline: |
| 216 | + |
| 217 | +```yaml |
| 218 | +# Example GitHub Actions workflow |
| 219 | +-name:Publish AppsFlyer module |
| 220 | +run:./gradlew publishModule -PmoduleName=analytiks-appsflyer |
| 221 | +env: |
| 222 | +SIGNING_KEY_ID:${{ secrets.SIGNING_KEY_ID }} |
| 223 | +SIGNING_PASSWORD:${{ secrets.SIGNING_PASSWORD }} |
| 224 | +SIGNING_KEY:${{ secrets.SIGNING_KEY }} |
| 225 | +CENTRAL_PORTAL_USERNAME:${{ secrets.CENTRAL_PORTAL_USERNAME }} |
| 226 | +CENTRAL_PORTAL_PASSWORD:${{ secrets.CENTRAL_PORTAL_PASSWORD }} |
| 227 | +``` |
| 228 | +
|
| 229 | +## Quick Reference |
| 230 | +
|
| 231 | +| Command | Description | |
| 232 | +|---------|-------------| |
| 233 | +|`publish.bat <module>` | Publish a specific module | |
| 234 | +| `publish.bat list` | List all available modules | |
| 235 | +| `publish.bat all-addons` | Publish all addon modules | |
| 236 | +| `publish.bat core` | Publish core modules | |
| 237 | +| `./gradlew listModules` | List all available modules | |
| 238 | +| `./gradlew publishModule -PmoduleName=<module>` | Publish a specific module | |
| 239 | +| `./gradlew publishAllAddons` | Publish all addon modules | |
| 240 | +| `./gradlew publishCore` | Publish core modules | |
| 241 | + |
| 242 | +## Support |
| 243 | + |
| 244 | +If you encounter issues: |
| 245 | + |
| 246 | +1. Check this guide for troubleshooting steps |
| 247 | +2. Review the Gradle output for error messages |
| 248 | +3. Check the Maven Central validation report |
| 249 | +4. Ensure all prerequisites are correctly configured |
| 250 | + |