Update files for in project release testing
1. commit anything and include one release type 2. run `pyb release` in project root 3. check that release commit and version bump commit were added 4. reset with `git reset origin/main`
This commit is contained in:
parent
b93772d3a1
commit
0cdf4b4c9c
3 changed files with 34 additions and 28 deletions
57
build.py
57
build.py
|
@ -1,10 +1,29 @@
|
|||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
from ddadevops import *
|
||||
|
||||
# getting the name of the directory
|
||||
# where the this file is present.
|
||||
current = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
# adding the current directory to
|
||||
# the sys.path.
|
||||
sys.path.append(current)
|
||||
|
||||
# now we can import the module in the current
|
||||
# directory.
|
||||
|
||||
from pybuilder.core import task, init
|
||||
from ddadevops import *
|
||||
from version import *
|
||||
from release_mixin import *
|
||||
from release_mixin import ReleaseMixin, create_release_mixin_config
|
||||
|
||||
CONFIG_FILE = ''
|
||||
CONFIG_FILE = Path('config.json')
|
||||
MAIN_BRANCH = 'main'
|
||||
STAGE = 'test'
|
||||
PROJECT_ROOT_PATH = '.'
|
||||
MODULE = 'test'
|
||||
BUILD_DIR_NAME = "build_dir"
|
||||
|
||||
class MyBuild(ReleaseMixin):
|
||||
pass
|
||||
|
@ -13,33 +32,17 @@ class MyBuild(ReleaseMixin):
|
|||
def initialize(project):
|
||||
project.build_depends_on('ddadevops>=3.1.2')
|
||||
config = create_release_mixin_config(CONFIG_FILE, MAIN_BRANCH)
|
||||
config.update({'stage': STAGE,
|
||||
'module': MODULE,
|
||||
'project_root_path': PROJECT_ROOT_PATH,
|
||||
'build_dir_name': BUILD_DIR_NAME})
|
||||
build = MyBuild(project, config)
|
||||
build.init()
|
||||
build.initialize_build_dir()
|
||||
|
||||
@task
|
||||
def release(project):
|
||||
build = get_devops_build(project)
|
||||
|
||||
prepare_release(build)
|
||||
tag_and_push_release(build)
|
||||
|
||||
prepare_version_bump(build)
|
||||
tag_and_push_version_bump(build)
|
||||
|
||||
def prepare_release(build):
|
||||
release_version = build.release_version
|
||||
build.prepare(release_version)
|
||||
|
||||
def tag_and_push_release(build):
|
||||
release_version = build.release_version
|
||||
build.tag_and_push(release_version)
|
||||
|
||||
def prepare_version_bump(build):
|
||||
bump_version = build.bump_version
|
||||
build.prepare(bump_version)
|
||||
|
||||
def tag_and_push_version_bump(build):
|
||||
bump_version = build.bump_version
|
||||
build.tag_and_push(bump_version)
|
||||
|
||||
|
||||
build.init_release()
|
||||
build.prepare_release()
|
||||
build.tag_and_push_release()
|
||||
|
|
3
config.json
Normal file
3
config.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"version": "123.125.1-SNAPSHOT"
|
||||
}
|
|
@ -64,6 +64,6 @@ class TagAndPushReleaseService():
|
|||
annotation = 'v' + release_version.get_version_string()
|
||||
message = 'Release ' + annotation
|
||||
self.git_repository.tag_annotated(annotation, message, 1)
|
||||
self.git_repository.push()
|
||||
# self.git_repository.push()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue