1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-14 22:42:34 +02:00

Fix zip naming and hash creation

This commit is contained in:
Elias Steurer 2023-08-20 12:44:38 +02:00
parent 126af43f5c
commit befa765117
2 changed files with 14 additions and 8 deletions

View File

@ -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")

View File

@ -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