|
| 1 | +# Mobi Lab MVVM Library Release Guide |
| 2 | + |
| 3 | +Disclaimer: This release guide assumes you are an employee of Mobi Lab and have access to the company's account in Codemagic CI. |
| 4 | + |
| 5 | +Note: Every time you notice something in this guide is out-of-date or incorrect then fix it right away. Only then does this document have any value. |
| 6 | + |
| 7 | +## Links |
| 8 | + |
| 9 | +- Repository on GitHub: https://github.com/LabMobi/mvvm-android |
| 10 | +- Sonatype OSSRH Nexus UI: [https://s01.oss.sonatype.org](https://s01.oss.sonatype.org/) |
| 11 | +- Artifacts on Maven Central: https://repo1.maven.org/maven2/mobi/lab/mvvm/mvvm/ (can take some time) |
| 12 | + - Artifacts on Sonatype OSSRH: https://s01.oss.sonatype.org/content/groups/public/mobi/lab/mvvm/mvvm/ (available right away after publishing) |
| 13 | +- Original Sonatype OSSRH JIRA issue: https://issues.sonatype.org/browse/OSSRH-66630 |
| 14 | + - Can be used to add user access |
| 15 | +- Project access Lab's internal Confluence: https://labmobi.atlassian.net/wiki/spaces/DEV/pages/15990951/Sonatype+Maven+Access+Credentials |
| 16 | +- Codemagic CI: https://codemagic.io/app/65310d8ec931a19db6581c3d/settings |
| 17 | +- OSSRH guide: https://central.sonatype.org/publish/publish-guide/ |
| 18 | + |
| 19 | +## Prerequisites |
| 20 | + |
| 21 | +1. Access to Lab's accounts at Codemagic (https://codemagic.io/apps) and OSSRH https://s01.oss.sonatype.org/. For manual publishing access to credentials at https://confluence.lab.mobi/display/DEV/Sonatype+Maven+Access+Credentials |
| 22 | + |
| 23 | +2. Make sure all the new features have been committed to `develop` branch. |
| 24 | + |
| 25 | +3. Make sure all the functionality in the `develop` branch works. |
| 26 | + |
| 27 | +4. Make sure the code in the `develop` builds correctly with the release build task: |
| 28 | + |
| 29 | + ```bash |
| 30 | + ./gradlew buildAllRelease |
| 31 | + ``` |
| 32 | + |
| 33 | +5. Make sure the "Compatible versions" list in the README.md is up-to-date |
| 34 | + |
| 35 | +## Release process |
| 36 | + |
| 37 | +1) Update the `CHANGELOG.md` document on the `develop` branch, add a section for this new release. If possible then follow https://keepachangelog.com/en/1.0.0/ |
| 38 | + |
| 39 | +Commit and push the change: |
| 40 | + |
| 41 | +```bash |
| 42 | +git add CHANGELOG.md |
| 43 | +git commit -m "Add changelog for version X.Y.Z" |
| 44 | +git push |
| 45 | +``` |
| 46 | + |
| 47 | +2) Make sure the version code in the `develop` branch is correct. If needed then update the library version from the `build.gradle` file in the project root folder: |
| 48 | + |
| 49 | +```groovy |
| 50 | +ext { |
| 51 | + // Current version of the library |
| 52 | + libraryVersion = "X.Y.Z" |
| 53 | +} |
| 54 | +``` |
| 55 | + |
| 56 | +Commit and push the changes |
| 57 | + |
| 58 | +```bash |
| 59 | +git add build.gradle |
| 60 | +git commit -m "Update the version code to X.Y.Z" |
| 61 | +git push |
| 62 | +``` |
| 63 | + |
| 64 | +2) Make sure the develop build (`develop-builds (Development builds)`) you just started at Codemagic CI is ok and everything is in green. |
| 65 | + |
| 66 | +3) Merge the `develop` branch to `main`. |
| 67 | + |
| 68 | +```bash |
| 69 | +git checkout develop |
| 70 | +git pull |
| 71 | +git checkout main |
| 72 | +git pull |
| 73 | +git merge develop |
| 74 | +git push |
| 75 | +``` |
| 76 | + |
| 77 | +4) Start the release build (`release-builds (Release builds for verification (main branch only))`) at Codemagic CI from the `main` branch, make sure it builds fine and everything is in green. |
| 78 | + |
| 79 | +5) Start the publish build (`publish-builds Publish to Maven builds (main branch only)`) at Codemagic CI from the `main` branch, make sure it builds fine and everything is in green. |
| 80 | + |
| 81 | +6) Open up https://s01.oss.sonatype.org/, navigate to Build Promotion -> Staging repositories, check the published repository there. |
| 82 | + |
| 83 | +- There should be a repository with the same version number |
| 84 | +- Download the `mvvm-x.y.z.aar` artifact from there, make sure it is ok. |
| 85 | + |
| 86 | +7. Publish the staging repository at https://s01.oss.sonatype.org/ as follows: |
| 87 | + |
| 88 | + - First mark it as `Closed`. This button triggers a validation process for your project. If the validation passes then proceed. Fix the issues otherwise |
| 89 | + - If you need to remove the repo and start again then use `Drop` |
| 90 | + |
| 91 | + - Release the closed repository. Now the new artifact should be available shortly on the Maven Central at https://repo1.maven.org/maven2/mobi/lab/lab/mvvm/mvvm/ |
| 92 | + |
| 93 | +- NOTE: Depending in the time of day this can take some time (wait up to 1h and then complain under the original JIRA issue) |
| 94 | + |
| 95 | +8. Create a new release and a Git tag in GitHub as follows: |
| 96 | + - Open up the GitHub release page at https://github.com/LabMobi/mvvm-android/releases, create a new release `vX.Y.Z`. Don't write an additional changelog there, just link to the changelog document. |
| 97 | + - Let it automatically create a tag for the release, in the form of "release-X.Y.Z". |
| 98 | + |
| 99 | +9) OPTIONAL: Update the library in at least one of the projects using it to make sure everything is in order. |
| 100 | + |
| 101 | +## Post-release actions |
| 102 | + |
| 103 | +1. In the `develop` branch update the library version code to a new version so the `develop` branch code and the released code does not have a matching version. |
| 104 | + |
| 105 | + |
| 106 | +``` |
| 107 | +git checkout develop |
| 108 | +git pull |
| 109 | +``` |
| 110 | + |
| 111 | + - Keep the release number in the style of X.Y.Z. |
| 112 | + |
| 113 | + |
| 114 | +```groovy |
| 115 | +ext { |
| 116 | + // Current version of the library |
| 117 | + libraryVersion = "X.Y.Z" |
| 118 | +} |
| 119 | +``` |
| 120 | + |
| 121 | +and commit and push the changes: |
| 122 | + |
| 123 | +```bash |
| 124 | +git add build.gradle |
| 125 | +git commit -m "Update the version code to X.Y.Z" |
| 126 | +git push |
| 127 | +``` |
| 128 | + |
| 129 | +## EXTRA: Manual publishing |
| 130 | + |
| 131 | +If for some reason CI can't be used for publishing then manual publishing process is overall the same as in CI, just skip the CI parts and |
| 132 | + |
| 133 | +1) Rename the `publish.properties_TEMPLATE` and fill it with the correct values. |
| 134 | + |
| 135 | +2) Check if the local publishing works by |
| 136 | + |
| 137 | +```bash |
| 138 | +./gradlew publishToMavenLocal |
| 139 | +``` |
| 140 | + |
| 141 | +The artifacts should be available under your user folder at `~/.m2/repository/mobi/lab/mvvm/mvvm/` |
| 142 | + |
| 143 | +3) If everything is in order then publish to OSSRH: |
| 144 | + |
| 145 | +```bash |
| 146 | +./gradlew buildAndPublishRelease |
| 147 | +``` |
| 148 | + |
| 149 | +After that follow the steps from OSSRH nexus described above. |
| 150 | + |
| 151 | +NOTE: To make the PGP private key to a single-line for props you can use the following command: |
| 152 | + |
| 153 | +```bash |
| 154 | +awk -v ORS='\\n' '1' mobi_lab_maven_artifact_PRIVATE_KEY.pgp > singlelinekey.txt |
| 155 | +``` |
| 156 | + |
0 commit comments