|
| 1 | +# Release Process |
| 2 | + |
| 3 | +This project is configured to automatically publish to Maven Central Repository using GitHub Actions. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +Before you can publish releases, you need to set up the following: |
| 8 | + |
| 9 | +### 1. Create a Sonatype Account |
| 10 | +- Register at [Maven Central Sonatype](https://central.sonatype.org/register/central-portal/#create-an-account) |
| 11 | + |
| 12 | +### 2. Register a Namespace |
| 13 | +- In your Sonatype account, [register a namespace](https://central.sonatype.org/register/namespace/) for `ms.imf` |
| 14 | + |
| 15 | +### 3. Generate GPG Key Pair |
| 16 | +Follow the [GPG guide](https://central.sonatype.org/publish/requirements/gpg/) to create your signing key: |
| 17 | + |
| 18 | +```bash |
| 19 | +gpg --gen-key |
| 20 | +gpg --list-keys |
| 21 | +gpg --armor --export-secret-keys YOUR_KEY_ID |
| 22 | +``` |
| 23 | + |
| 24 | +### 4. Generate Central Token |
| 25 | +- In your Sonatype account, [generate a user token](https://central.sonatype.org/publish/generate-token/) |
| 26 | + |
| 27 | +### 5. Configure GitHub Secrets |
| 28 | +Add the following secrets to your GitHub repository settings: |
| 29 | + |
| 30 | +- **`CENTRAL_TOKEN_USERNAME`**: The username from your Sonatype user token |
| 31 | +- **`CENTRAL_TOKEN_PASSWORD`**: The password from your Sonatype user token |
| 32 | +- **`GPG_SIGNING_KEY`**: Your exported private GPG key (from step 3) |
| 33 | +- **`GPG_SIGNING_KEY_PASSWORD`**: The password for your GPG key |
| 34 | + |
| 35 | +## Publishing a Release |
| 36 | + |
| 37 | +Once the prerequisites are set up, publishing a new version is simple: |
| 38 | + |
| 39 | +1. **Create a GitHub Release**: |
| 40 | + - Go to your GitHub repository |
| 41 | + - Click "Releases" → "Create a new release" |
| 42 | + - Choose a tag (e.g., `1.0.1`, `2.0.0`) |
| 43 | + - Add release notes |
| 44 | + - Click "Publish release" |
| 45 | + |
| 46 | +2. **Automatic Publishing**: |
| 47 | + - The GitHub Action will automatically trigger |
| 48 | + - It will set the project version to your release tag |
| 49 | + - Build and sign the artifacts |
| 50 | + - Deploy to Maven Central Repository |
| 51 | + |
| 52 | +3. **Verification**: |
| 53 | + - Check the Actions tab to monitor the deployment |
| 54 | + - Once complete, your artifact will be available on [Maven Central](https://central.sonatype.com/) |
| 55 | + |
| 56 | +## Release Profiles |
| 57 | + |
| 58 | +The project includes two release profiles: |
| 59 | + |
| 60 | +- **`release`**: New profile for Maven Central publishing via GitHub Actions |
| 61 | +- **`legacy-release`**: Previous profile for manual releases via OSSRH |
| 62 | + |
| 63 | +## Manual Release (Alternative) |
| 64 | + |
| 65 | +If you prefer to release manually, you can use the legacy profile: |
| 66 | + |
| 67 | +```bash |
| 68 | +mvn -P legacy-release clean deploy |
| 69 | +``` |
| 70 | + |
| 71 | +## Troubleshooting |
| 72 | + |
| 73 | +### Common Issues: |
| 74 | + |
| 75 | +1. **GPG Signing Fails**: Ensure your GPG_SIGNING_KEY secret contains the complete private key |
| 76 | +2. **Authentication Fails**: Verify your Sonatype token credentials are correct |
| 77 | +3. **Namespace Issues**: Make sure you own the `ms.imf` namespace in Sonatype |
| 78 | + |
| 79 | +### Getting Help: |
| 80 | + |
| 81 | +- [Maven Central Publishing Guide](https://central.sonatype.org/publish/publish-portal-maven/) |
| 82 | +- [GitHub Actions Documentation](https://docs.github.com/en/actions) |
0 commit comments