From 27c85cc852fca937086b82328120319d6fbef501 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Thu, 26 Sep 2024 20:52:09 -0400 Subject: [PATCH] testing minor release and branch --- CMakeLists.txt | 2 +- commit.py | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d6112f..539a17c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.25) -project(COSC-4P80-Assignment-1 VERSION 13.0.0) +project(COSC-4P80-Assignment-1 VERSION 13.1.0) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_UBSAN "Enable the ub sanitizer" OFF) diff --git a/commit.py b/commit.py index 5e7c282..3dfbcbb 100755 --- a/commit.py +++ b/commit.py @@ -56,10 +56,15 @@ class Config: content[idx] = c.replace("export", "").strip() values[content[0]] = content[1].replace("\"", "").replace("'", "") config = Config() - config.branch_on_major = values["branch_on_major"].lower() == "true" - config.release_on_major = values["release_on_major"].lower() == "true" - config.main_branch = values["main_branch"] - config.patch_limit = int(values["patch_limit"]) + try: + config.branch_on_major = values["branch_on_major"].lower() == "true" + config.branch_on_minor = values["branch_on_minor"].lower() == "true" + config.release_on_major = values["release_on_major"].lower() == "true" + config.release_on_minor = values["release_on_minor"].lower() == "true" + config.main_branch = values["main_branch"] + config.patch_limit = int(values["patch_limit"]) + except: + return config return config; @@ -71,7 +76,9 @@ class Config: os.makedirs(dir) with open(file, 'w') as f: f.write("export branch_on_major=" + str(self.branch_on_major) + "\n") + f.write("export branch_on_minor=" + str(self.branch_on_minor) + "\n") f.write("export release_on_major=" + str(self.release_on_major) + "\n") + f.write("export release_on_minor=" + str(self.release_on_minor) + "\n") f.write('export main_branch="' + self.main_branch + '"' + "\n") f.write("export patch_limit=" + str(self.patch_limit) + "\n") @@ -176,11 +183,10 @@ def make_release(env: EnvData, name): origin = ''.join(itertools.takewhile(str.isalpha, line.decode('utf8'))) urls.append("https://api.github.com/repos/" + open_process(["git", "remote", "get-url", origin], False)[0].decode('utf8').replace("\n", "").replace("https://github.com/", "") + "/releases") urls = set(urls) - print(f"Urls: {urls}") data = { 'tag_name': name, 'name': name, - 'body': "Automated Release", + 'body': "Automated Release '" + name + "'", 'draft': False, 'prerelease': False } @@ -270,13 +276,14 @@ def main(): make_branch(config, "v" + str(version_parts[0])) if config.branch_on_minor: make_branch(config, "v" + str(version_parts[0]) + "." + str(version_parts[1])) + + subprocess.call(["sh", "-c", "git remote | xargs -L1 git push --all"]) + + if args.major: if config.release_on_major: make_release(env, "v" + str(version_parts[0])) if config.release_on_minor: make_release(env, "v" + str(version_parts[0]) + "." + str(version_parts[1])) - - - subprocess.call(["sh", "-c", "git remote | xargs -L1 git push --all"]) if __name__ == "__main__": main()