buildtest/build.py
2024-01-12 11:29:56 +01:00

84 lines
1.7 KiB
Python

from os import environ
from pybuilder.core import task, init
from ddadevops import *
name = "buildtest"
MODULE = "release"
PROJECT_ROOT_PATH = "."
version = "1.8.5-dev"
@init
def initialize(project):
input = {
"name": name,
"module": MODULE,
"stage": "notused",
"project_root_path": PROJECT_ROOT_PATH,
"build_types": [],
"mixin_types": ["RELEASE"],
"release_primary_build_file": "build.py",
"release_secondary_build_files": ["package.json", "project.clj", "build.gradle", "build_to_test.py"],
"release_artifacts": ["README.md"],
"release_artifact_server_url": "https://repo.prod.meissa.de",
"release_organisation": "meissa",
"release_repository_name": name,
}
project.build_depends_on("ddadevops>=4.10.7")
build = ReleaseMixin(project, input)
build.initialize_build_dir()
@task
def patch(project):
linttest(project, "PATCH")
release(project)
@task
def minor(project):
linttest(project, "MINOR")
release(project)
@task
def major(project):
linttest(project, "MAJOR")
release(project)
@task
def dev(project):
linttest(project, "NONE")
@task
def prepare(project):
build = get_devops_build(project)
build.prepare_release()
@task
def tag(project):
build = get_devops_build(project)
build.tag_bump_and_push_release()
@task
def publish_artifacts(project):
build = get_devops_build(project)
print("PROTECTED_TOKEN_EXAMPLE" in environ)
print(environ.get("PROTECTED_TOKEN_EXAMPLE"))
build.publish_artifacts()
def release(project):
prepare(project)
tag(project)
def linttest(project, release_type):
build = get_devops_build(project)
build.update_release_type(release_type)