From befa765117ef716549b76cbde2bc9a1673fec6f3 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Sun, 20 Aug 2023 12:44:38 +0200 Subject: [PATCH] Fix zip naming and hash creation --- Tools/publish_ci.py | 20 +++++++++++++------- Tools/util.py | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Tools/publish_ci.py b/Tools/publish_ci.py index 579b9bd3..562d384d 100644 --- a/Tools/publish_ci.py +++ b/Tools/publish_ci.py @@ -1,20 +1,26 @@ import hashlib import os +from pathlib import Path +import util def combine_sha256(): + tag = os.environ['CI_COMMIT_TAG'] + + # Get the repo root path as a Path object + root_path = Path(util.repo_root_path()) + files = [ - "build-x64-linux-release/ScreenPlay-" + - os.environ['CI_COMMIT_TAG'] + "-x64-linux-release.zip", - "build-x64-windows-release/ScreenPlay-" + - os.environ['CI_COMMIT_TAG'] + "-x64-windows-release.zip", - "build-64-osx-universal-release/ScreenPlay-" + - os.environ['CI_COMMIT_TAG'] + "-x64-osx-universal-release.zip" + Path( + f"{root_path}/build-x64-windows-release/ScreenPlay-{tag}-x64-windows-release.zip"), + Path( + f"{root_path}/build-x64-linux-release/ScreenPlay-{tag}-x64-linux-release.zip"), + Path(f"{root_path}/build-64-osx-universal-release/ScreenPlay-{tag}-64-osx-universal-release.zip") ] with open('SHA512-SUMS.txt', 'w') as f_out: for file in files: - with open(f"{file}.sha256.txt", 'r') as f_in: + with open(file.with_name(f"{file.name}.sha256.txt"), 'r') as f_in: sha256_hash = f_in.read().strip() sha512_hash = hashlib.sha512(sha256_hash.encode()).hexdigest() f_out.write(f"{sha512_hash} {file}\n") diff --git a/Tools/util.py b/Tools/util.py index 4efa8c74..5a24cca1 100644 --- a/Tools/util.py +++ b/Tools/util.py @@ -140,7 +140,7 @@ def parse_semver(tag): def semver_to_string(semver_dict): - version_str = f"V{semver_dict['major']}.{semver_dict['minor']}.{semver_dict['patch']}" + version_str = f"v{semver_dict['major']}.{semver_dict['minor']}.{semver_dict['patch']}" if semver_dict['pre_release']: version_str += f"-{semver_dict['pre_release']}" return version_str