|
| 1 | +# Release Process |
| 2 | + |
| 3 | +This document describes the automated release process for xAPI Java. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The release process is **fully automated** via GitHub Actions. Creating a release is as simple as: |
| 8 | +1. Click "Create Release" in GitHub UI |
| 9 | +2. Enter tag (e.g., `v1.2.0`) |
| 10 | +3. Publish |
| 11 | +4. Wait for workflow to complete ✅ |
| 12 | + |
| 13 | +All version management, building, testing, and deployment happens automatically. |
| 14 | + |
| 15 | +## Automated Release Process |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +### Step 1: Create a GitHub Release |
| 20 | + |
| 21 | +1. Navigate to the [Releases page](https://github.com/BerryCloud/xapi-java/releases) |
| 22 | +2. Click **"Draft a new release"** |
| 23 | +3. **Choose a tag**: Enter the tag version in the format: `vX.Y.Z` (e.g., `v1.2.0`) |
| 24 | + - The tag **must** start with `v` followed by semantic version numbers |
| 25 | + - Example: `v1.1.16`, `v2.0.0`, `v1.2.3` |
| 26 | +4. **Target**: Select the branch to release from (typically `main`) |
| 27 | + - The workflow will automatically detect and use this branch |
| 28 | +5. Enter a release title (e.g., "Release 1.2.0") |
| 29 | +6. Add release notes describing the changes |
| 30 | +7. Click **"Publish release"** |
| 31 | + |
| 32 | +### Step 2: Automated Workflow Execution |
| 33 | + |
| 34 | +Once you publish the release, the "Automated Release" workflow will: |
| 35 | + |
| 36 | +1. ✅ Validate the tag format (must be `vX.Y.Z`) |
| 37 | +2. ✅ Detect the target branch (auto-detected from release) |
| 38 | +3. ✅ Delete the user-created tag (will be recreated properly) |
| 39 | +4. ✅ **Run Maven release:prepare** to: |
| 40 | + - Update all `pom.xml` files to the release version |
| 41 | + - Commit the version change |
| 42 | + - Create the release tag pointing to the release commit |
| 43 | + - Update `pom.xml` files to the next SNAPSHOT version |
| 44 | + - Commit the next development iteration |
| 45 | +5. ✅ **Run Maven release:perform** to: |
| 46 | + - Check out the release tag |
| 47 | + - Build and test the release version |
| 48 | + - Deploy artifacts to Maven Central with GPG signatures |
| 49 | +6. ✅ Push commits and tag back to the originating branch |
| 50 | + |
| 51 | +**Workflow Diagram:** |
| 52 | +``` |
| 53 | +User Action: Create Release (tag: v1.2.0, target: main) |
| 54 | + ↓ |
| 55 | +GitHub: Creates tag v1.2.0 → commit A (from main) |
| 56 | + ↓ |
| 57 | +Workflow: Detects target branch (main) |
| 58 | + ↓ |
| 59 | +Workflow: Deletes user-created tag v1.2.0 |
| 60 | + ↓ |
| 61 | +Workflow: Runs release:prepare |
| 62 | + ↓ |
| 63 | + - Commit B: pom.xml → 1.2.0 (release version) |
| 64 | + - Creates tag v1.2.0 → commit B |
| 65 | + - Commit C: pom.xml → 1.2.1-SNAPSHOT (next dev version) |
| 66 | + ↓ |
| 67 | +Workflow: Runs release:perform |
| 68 | + ↓ |
| 69 | + - Checks out tag v1.2.0 (commit B) |
| 70 | + - Builds and tests |
| 71 | + - Deploys to Maven Central |
| 72 | + ↓ |
| 73 | +Workflow: Pushes commits B & C to main |
| 74 | + ↓ |
| 75 | +Workflow: Pushes tag v1.2.0 → commit B |
| 76 | + ↓ |
| 77 | +Result: |
| 78 | + - Tag v1.2.0 → commit B (release version) |
| 79 | + - Main branch → commit C (next SNAPSHOT: 1.2.1-SNAPSHOT) |
| 80 | + - Artifacts deployed to Maven Central |
| 81 | +``` |
| 82 | + |
| 83 | +### Step 3: Verify Release |
| 84 | + |
| 85 | +1. Check the [Actions tab](https://github.com/BerryCloud/xapi-java/actions) to ensure the workflow completed successfully |
| 86 | +2. Verify the target branch (e.g., `main`) has two new commits: |
| 87 | + - Release commit: `[maven-release-plugin] prepare release vX.Y.Z` |
| 88 | + - Development commit: `[maven-release-plugin] prepare for next development iteration` |
| 89 | +3. Verify artifacts are available on [Maven Central](https://central.sonatype.com/artifact/dev.learning.xapi/xapi-model) |
| 90 | + |
| 91 | +## Release Branch Strategy |
| 92 | + |
| 93 | +- **Main branch (`main`)** (or other target branch): Contains development code with `-SNAPSHOT` versions |
| 94 | + - After each release, receives two commits from Maven release plugin: |
| 95 | + 1. Release commit: Version update to release version (X.Y.Z) |
| 96 | + 2. Development commit: Version update to next development version (X.Y.Z+1-SNAPSHOT) |
| 97 | + - The HEAD always points to the next development version |
| 98 | +- **Release tags (`vX.Y.Z`)**: Created by Maven release plugin |
| 99 | + - Points to the release version commit (first commit) |
| 100 | + - Used for reproducible builds and deployments |
| 101 | +- **No separate release branches**: The release workflow pushes directly to the originating branch |
| 102 | + |
| 103 | +## Troubleshooting |
| 104 | + |
| 105 | +### Release Workflow Failed |
| 106 | + |
| 107 | +If the automated release workflow fails: |
| 108 | + |
| 109 | +1. **Check the workflow logs** in the [Actions tab](https://github.com/BerryCloud/xapi-java/actions) |
| 110 | +2. **Identify the failed step** and review the error message |
| 111 | +3. **Common issues and solutions:** |
| 112 | + |
| 113 | + | Issue | Solution | |
| 114 | + |-------|----------| |
| 115 | + | Invalid tag format | Use format `vX.Y.Z` (e.g., `v1.2.0`, not `1.2.0` or `v1.2`) | |
| 116 | + | Missing secrets | Ensure GPG keys and Maven credentials are configured in repository secrets | |
| 117 | + | Build failures | Fix build issues on main branch first, then retry release | |
| 118 | + | Test failures | Fix failing tests on main branch first, then retry release | |
| 119 | + |
| 120 | +4. **After fixing issues:** |
| 121 | + - Delete the failed release and tag in GitHub UI |
| 122 | + - **Important**: Reset your target branch if commits were already pushed: |
| 123 | + ```bash |
| 124 | + # If release:prepare pushed commits before failure |
| 125 | + git fetch origin |
| 126 | + git checkout main # or your target branch |
| 127 | + git reset --hard origin/main~2 # Remove the 2 release commits |
| 128 | + git push -f origin main |
| 129 | + ``` |
| 130 | + - Create a new release with the same tag |
| 131 | + |
| 132 | +### Workflow Stuck or Taking Too Long |
| 133 | + |
| 134 | +The workflow typically takes 5-10 minutes. If it's taking longer: |
| 135 | +
|
| 136 | +1. Check if tests are running (this is the longest step) |
| 137 | +2. Check for any hanging processes in the workflow logs |
| 138 | +3. You can cancel the workflow run and restart it |
| 139 | +
|
| 140 | +### Artifacts Not Appearing on Maven Central |
| 141 | +
|
| 142 | +If artifacts don't appear on Maven Central after a successful workflow: |
| 143 | + |
| 144 | +1. Check the Central Portal for deployment status: https://central.sonatype.com/ |
| 145 | +2. Deployment can take up to 2 hours to sync to Maven Central |
| 146 | +3. Check for any deployment errors in the workflow logs |
| 147 | +4. Verify GPG signing was successful (check for GPG-related errors) |
0 commit comments