buildtest/build.py

84 lines
1.7 KiB
Python
Raw Normal View History

2023-05-19 14:01:33 +00:00
from os import environ
from pybuilder.core import task, init
from ddadevops import *
name = "buildtest"
MODULE = "release"
PROJECT_ROOT_PATH = "."
@init
def initialize(project):
input = {
"name": name,
"module": MODULE,
"stage": "notused",
"project_root_path": PROJECT_ROOT_PATH,
"build_types": [],
"mixin_types": ["RELEASE"],
2023-07-07 14:03:09 +00:00
"release_primary_build_file": "build_to_test.py",
"release_secondary_build_files": ["package.json", "project.clj"],
2023-08-17 06:46:22 +00:00
"release_artifacts": [],
"release_artifact_server_url": "https://repo.prod.meissa.de",
"release_organisation": "meissa",
"release_repository_name": name,
2023-05-19 14:01:33 +00:00
}
project.build_depends_on("ddadevops>=4.0.0-dev")
2023-07-07 14:03:09 +00:00
2023-07-06 15:53:19 +00:00
build = ReleaseMixin(project, input)
2023-05-19 14:01:33 +00:00
build.initialize_build_dir()
2023-07-06 15:53:19 +00:00
@task
def patch(project):
2023-08-17 07:26:58 +00:00
linttest(project, "PATCH")
release(project)
2023-07-06 15:53:19 +00:00
2023-07-07 14:03:09 +00:00
2023-07-06 15:53:19 +00:00
@task
def minor(project):
2023-08-17 07:26:58 +00:00
linttest(project, "MINOR")
release(project)
2023-07-06 15:53:19 +00:00
2023-07-07 14:03:09 +00:00
2023-07-06 15:53:19 +00:00
@task
def major(project):
2023-08-17 07:26:58 +00:00
linttest(project, "MAJOR")
release(project)
2023-07-07 14:03:09 +00:00
2023-07-06 15:53:19 +00:00
@task
def dev(project):
2023-08-17 07:26:58 +00:00
linttest(project, "NONE")
2023-07-06 15:53:19 +00:00
2023-07-07 14:03:09 +00:00
2023-07-06 15:53:19 +00:00
@task
2023-08-17 07:26:58 +00:00
def prepare(project):
2023-05-19 14:01:33 +00:00
build = get_devops_build(project)
build.prepare_release()
2023-07-07 14:03:09 +00:00
2023-05-19 14:01:33 +00:00
@task
2023-08-17 07:26:58 +00:00
def tag(project):
2023-05-19 14:01:33 +00:00
build = get_devops_build(project)
build.tag_bump_and_push_release()
2023-07-06 15:53:19 +00:00
2023-08-17 06:46:22 +00:00
@task
def publish_artifacts(project):
build = get_devops_build(project)
2023-08-17 14:34:27 +00:00
print("PROTECTED_TOKEN_EXAMPLE" in environ)
print(environ.get("PROTECTED_TOKEN_EXAMPLE"))
2023-08-17 07:26:58 +00:00
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)