diff --git a/doc/ReleaseMixin.md b/doc/ReleaseMixin.md new file mode 100644 index 0000000..8cc624d --- /dev/null +++ b/doc/ReleaseMixin.md @@ -0,0 +1,81 @@ +# ReleaseMixin + +Support for Releases following the trunk-based-release flow (see https://trunkbaseddevelopment.com/) + +```mermaid +classDiagram + class ReleaseMixin { + prepare_release() - adjust all build files to carry the correct version & commit localy + tag_and_push_release() - tag the git repo and push changes to origin + } + +``` + +## Input + +| name | description | default | +| ----------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------- | +| release_type | one of MAJOR, MINOR, PATCH, NONE | "NONE" | +| release_main_branch | the name of your trank | "main" | +| release_primary_build_file | path to the build file having the leading version info (read & write). Valid extensions are .clj, .json, .gradle, .py | "./project.clj" | +| release_secondary_build_files | list of secondary build files, version is written in. | [] | + +## Example Usage + +### build.py + +```python +rom os import environ +from pybuilder.core import task, init +from ddadevops import * + +name = 'my-project' +MODULE = 'my-module' +PROJECT_ROOT_PATH = '..' + +@init +def initialize(project): + project.build_depends_on("ddadevops>=4.0.0") + + input = { + "name": name, + "module": MODULE, + "stage": "notused", + "project_root_path": PROJECT_ROOT_PATH, + "build_types": [], + "mixin_types": ["RELEASE"], + "release_type": "MINOR", + "release_primary_build_file": "project.clj", + "release_secondary_build_files": ["package.json"], + } + + roject.build_depends_on("ddadevops>=4.0.0-dev") + + build = ReleaseMixin(project, input) + build.initialize_build_dir() + + +@task +def prepare_release(project): + build = get_devops_build(project) + build.prepare_release() + +@task +def build(project): + print("do the build") + +@task +def publish(project): + print("publish your artefacts") + +@task +def after_publish(project): + build = get_devops_build(project) + build.tag_bump_and_push_release() +``` + +### call the build + +```bash +pyb prepare_release build publish after_publish +```