|
| 1 | +# Versioning guidelines for CDOC2 project |
| 2 | + |
| 3 | +CDOC2 modules are split between two repositories (or more in future). As all modules are not in the |
| 4 | +same repository, then version management becomes necessity. |
| 5 | + |
| 6 | +To help with version management, this document describes some ways to manage module versions. |
| 7 | + |
| 8 | +CDOC2 project tries to follow [semantic versioning](https://semver.org/) |
| 9 | + |
| 10 | +## Development without release (inc_version.sh) |
| 11 | + |
| 12 | +* Create feature branch <TASK_ID>_<short_description> |
| 13 | +* Make changes |
| 14 | + |
| 15 | +Before opening merge request, run `inc_versions.sh -d` (dry-run) and `inc_versions.sh` |
| 16 | + |
| 17 | +This, will scan modules and increase module version only for changed modules that are not already on |
| 18 | +"-SNAPSHOT" version. Changes are detected only for current branch and won't work for main branch. |
| 19 | + |
| 20 | +* `git diff` to verify changes |
| 21 | +* Commit, push |
| 22 | +* Create MR |
| 23 | + |
| 24 | +`inc_version.sh -d` will print out changed modules, but doesn't change any files. |
| 25 | + |
| 26 | +The script is not perfect, for example if you only change README in a module, then module is still |
| 27 | +considered changed although no code changes. |
| 28 | + |
| 29 | +## Using latest version of modules (use_latest_snapshot.sh) |
| 30 | + |
| 31 | +After creating new version Maven module or artifact, install it locally |
| 32 | + |
| 33 | +`mvn install` |
| 34 | +`mvn -f <module_name> install` |
| 35 | + |
| 36 | +### Update cdoc2 dependencies for single module |
| 37 | + |
| 38 | +* `mvn -f <module> versions:use-latest-versions -Dincludes=ee.cyber.cdoc2:* -DexcludeReactor=false -DallowSnapshots=true` |
| 39 | + |
| 40 | +Example: `mvn -f cdoc2-server/get-server versions:use-latest-versions -Dincludes=ee.cyber.cdoc2:* -DexcludeReactor=false -DallowSnapshots=true` |
| 41 | + |
| 42 | + |
| 43 | +### Update cdoc2 dependencies for all modules in repository |
| 44 | + |
| 45 | +* Run `use_latest_snapshot.sh` to update all modules |
| 46 | +* `git diff` to verify changes |
| 47 | + |
| 48 | +## Releases (prepare_release.sh and make_release.sh) |
| 49 | + |
| 50 | +General release procedure: |
| 51 | + |
| 52 | +* Checkout clean branch (usually 'master') |
| 53 | +* `prepare_release.sh` (changes versions to RELEASE versions and runs tests) |
| 54 | +* Verify changes (`git diff`) |
| 55 | +* Edit CHANGELOG.md |
| 56 | +* `make_release.sh` (`git commit; git push` RELEASE branch and `mvn deploy` RELEASE artifacts) |
| 57 | + |
| 58 | +This will change -SNAPSHOT version to release version, update dependencies in all modules to latest |
| 59 | +non-SNAPSHOT version. Build, test, create release branch, push changes, deploy maven artifacts. |
| 60 | + |
| 61 | +Without parameters `prepare_release.sh` will use version (with -SNAPSHOT removed) from parent pom. |
| 62 | +To specify custom release version use `-v`, example `prepare_release.sh -v 1.2.3`. This will update |
| 63 | +version in parent pom before changing other versions. |
| 64 | + |
| 65 | +If everything went well, then |
| 66 | +* release branch was created with name 'release_v<parent-pom.version>' |
| 67 | +* Maven artifacts with release version are in Maven repository |
| 68 | +* original branch is checked out ('master' usually) |
| 69 | + |
| 70 | +To finish create squash merge from release branch to main branch |
| 71 | +```bash |
| 72 | +git merge --squash $RELEASE_BRANCH |
| 73 | +git commit -m "Squashed commit from $RELEASE_BRANCH" |
| 74 | +git push $GIT_REMOTE $GIT_BRANCH |
| 75 | +``` |
| 76 | + |
| 77 | +### Release cdoc2-java-ref-impl and cdoc2-capsule-server |
| 78 | + |
| 79 | +Since test code for cdoc2-capsule-server depends on cdoc2-java-ref-impl `cdoc2-lib` module and |
| 80 | +transiently `cdoc2-client` module, then for bigger releases following procedure is recommended: |
| 81 | + |
| 82 | +* Checkout both repositories |
| 83 | +* Run `prepare_release.sh` in `cdoc2-java-ref-impl` and then in `cdoc2-capsule-server`. That installs |
| 84 | + `cdoc2-lib` into local maven repository and `cdoc2-capsule-server` will use it during testing |
| 85 | + ('mvn verify') |
| 86 | +* Update CHANGELOGs in both repositories |
| 87 | +* Run `make_release.sh` in `cdoc2-java-ref-impl` and then in `cdoc2-capsule-server` |
| 88 | + |
| 89 | +### make_release.sh without deploy |
| 90 | + |
| 91 | +`make_release.sh -d` will create release branch, but will not deploy Maven artifacts. |
0 commit comments