mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-25 04:02:50 +01:00
Remove ScreePlay version from defines.py
We now use always the latest set git tag as version. This means we also no longer need to add it as an argument
This commit is contained in:
parent
18b8c4025b
commit
58567987aa
@ -3,24 +3,33 @@ steam_linux:
|
||||
extends:
|
||||
- .base_linux_build
|
||||
script:
|
||||
- python3 Tools/build.py --type=release --steam --deploy-version --use-aqt --installer --tag $CI_COMMIT_TAG
|
||||
- python3 Tools/build.py --type=release --steam --deploy-version --use-aqt --installer
|
||||
rules:
|
||||
- if: "$CI_COMMIT_TAG"
|
||||
artifacts:
|
||||
paths:
|
||||
- build-x64-linux-release/bin
|
||||
|
||||
steam_windows:
|
||||
stage: release_build
|
||||
extends:
|
||||
- .base_windows_build
|
||||
script:
|
||||
- python Tools/build.py --type=release --steam --use-aqt --deploy-version --tag $CI_COMMIT_TAG
|
||||
- python Tools/build.py --type=release --steam --use-aqt --deploy-version
|
||||
rules:
|
||||
- if: "$CI_COMMIT_TAG"
|
||||
|
||||
artifacts:
|
||||
paths:
|
||||
- build-x64-windows-release/ScreenPlay-Installer.exe
|
||||
- build-x64-windows-release/ScreenPlay-$CI_COMMIT_TAG-x64-windows-release.zip
|
||||
steam_osx:
|
||||
stage: release_build
|
||||
extends:
|
||||
- .base_osx_build
|
||||
script:
|
||||
- python3 Tools/build.py --type=release --steam --use-aqt --deploy-version -sign_osx --tag $CI_COMMIT_TAG
|
||||
- python3 Tools/build.py --type=release --steam --use-aqt --deploy-version -sign_osx
|
||||
rules:
|
||||
- if: "$CI_COMMIT_TAG"
|
||||
artifacts:
|
||||
paths:
|
||||
- build-64-osx-universal-release/ScreenPlay.app
|
||||
|
4
.vscode/tasks.json
vendored
4
.vscode/tasks.json
vendored
@ -104,14 +104,14 @@
|
||||
"build.py",
|
||||
"--type=release",
|
||||
"--deploy-version",
|
||||
"-steam"
|
||||
"--steam"
|
||||
]
|
||||
},
|
||||
"args": [
|
||||
"build.py",
|
||||
"--type=release",
|
||||
"--deploy-version",
|
||||
"-steam"
|
||||
"--steam"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -21,6 +21,7 @@ function(get_project_version VERSION_VAR)
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
||||
message(STATUS "Parsing git tag: ${GIT_VERSION}")
|
||||
string(REPLACE "V" "" STRIPPED_VERSION "${GIT_VERSION}") # Remove the 'V' prefix
|
||||
string(REPLACE "-" ";" VERSION_LIST ${STRIPPED_VERSION})
|
||||
list(GET VERSION_LIST 0 VERSION_STRING)
|
||||
|
@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.23.0)
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
|
||||
include(GetProjectVersion)
|
||||
get_project_version(PROJECT_VERSION)
|
||||
message(STATUS "Version: ${PROJECT_VERSION}")
|
||||
|
||||
project(
|
||||
ScreenPlay
|
||||
@ -140,18 +139,19 @@ if(${SCREENPLAY_INSTALLER} AND NOT APPLE)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CreateIFWInstaller.cmake)
|
||||
endif()
|
||||
|
||||
message(STATUS "[CPP DEFINE] DEPLOY_VERSION = ${DEPLOY_VERSION}")
|
||||
message(STATUS "[CPP DEFINE] SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
message(STATUS "[CPP DEFINE] BUILD_DATE = ${BUILD_DATE}")
|
||||
message(STATUS "[DEFINE] BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
|
||||
message(STATUS "[DEFINE] GIT_COMMIT_HASH = ${GIT_COMMIT_HASH}")
|
||||
message(STATUS "[OPTION] SCREENPLAY_DEPLOY = ${SCREENPLAY_DEPLOY}")
|
||||
message(STATUS "[OPTION] SCREENPLAY_INSTALLER = ${SCREENPLAY_INSTALLER}")
|
||||
message(STATUS "[OPTION] SCREENPLAY_STEAM = ${SCREENPLAY_STEAM}")
|
||||
message(STATUS "[OPTION] SCREENPLAY_TESTS = ${SCREENPLAY_TESTS}")
|
||||
message(STATUS "[PROJECT] PROJECT_VERSION = ${PROJECT_VERSION}")
|
||||
message(STATUS "[PROJECT] CMAKE_VERSION = ${CMAKE_VERSION}")
|
||||
message(STATUS "[PROJECT] SCREENPLAY_QML_MODULES_PATH = ${SCREENPLAY_QML_MODULES_PATH}")
|
||||
message(STATUS "[PROJECT] CMAKE_TOOLCHAIN_FILE = ${CMAKE_TOOLCHAIN_FILE}")
|
||||
message(STATUS "[PROJECT] VCPKG_PATH = ${VCPKG_PATH}")
|
||||
message(STATUS "[PROJECT] VCPKG_TARGET_TRIPLET = ${VCPKG_TARGET_TRIPLET}")
|
||||
message(STATUS "[PROJECT] CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
|
||||
message(STATUS "[PROJECT] CMAKE_VERSION = ${CMAKE_VERSION}")
|
||||
message(STATUS "[OPTION] SCREENPLAY_DEPLOY = ${SCREENPLAY_DEPLOY}")
|
||||
message(STATUS "[OPTION] SCREENPLAY_INSTALLER = ${SCREENPLAY_INSTALLER}")
|
||||
message(STATUS "[OPTION] SCREENPLAY_STEAM = ${SCREENPLAY_STEAM}")
|
||||
message(STATUS "[OPTION] SCREENPLAY_TESTS = ${SCREENPLAY_TESTS}")
|
||||
message(STATUS "[DEFINE] BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
|
||||
message(STATUS "[DEFINE] GIT_COMMIT_HASH = ${GIT_COMMIT_HASH}")
|
||||
message(STATUS "[CPP DEFINE] DEPLOY_VERSION = ${DEPLOY_VERSION}")
|
||||
message(STATUS "[CPP DEFINE] SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
message(STATUS "[CPP DEFINE] BUILD_DATE = ${BUILD_DATE}")
|
||||
|
@ -11,7 +11,7 @@ import defines
|
||||
from typing import Tuple
|
||||
from pathlib import Path
|
||||
import macos_sign
|
||||
from util import sha256, cd_repo_root_path, repo_root_path, zipdir, run, get_vs_env_dict
|
||||
from util import sha256, cd_repo_root_path, repo_root_path, zipdir, run, get_vs_env_dict, get_latest_git_tag, parse_semver, semver_to_string
|
||||
from sys import stdout
|
||||
|
||||
stdout.reconfigure(encoding='utf-8')
|
||||
@ -213,7 +213,7 @@ def build(build_config: BuildConfig, build_result: BuildResult) -> BuildResult:
|
||||
-DSCREENPLAY_DEPLOY={build_config.build_deploy} \
|
||||
-DSCREENPLAY_INSTALLER={build_config.create_installer} \
|
||||
-DSCREENPLAY_IFW_ROOT:STRING={build_config.ifw_root_path} \
|
||||
-G "CodeBlocks - Ninja" \
|
||||
-G "Ninja" \
|
||||
-B.'
|
||||
|
||||
print(f"\n⚙️ CMake configure:\n", cmake_configure_command.replace(
|
||||
@ -375,7 +375,6 @@ if __name__ == "__main__":
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Build and Package ScreenPlay')
|
||||
parser.add_argument('--tag', type=str, help="GitLab CI tag", default="")
|
||||
parser.add_argument('--qt-version', action="store", dest="qt_version_overwrite",
|
||||
help="Overwrites the default Qt version")
|
||||
parser.add_argument('--qt-installer-version', action="store", dest="qt_installer_version_overwrite",
|
||||
@ -399,14 +398,24 @@ if __name__ == "__main__":
|
||||
args = parser.parse_args()
|
||||
|
||||
qt_version = defines.QT_VERSION
|
||||
if args.tag:
|
||||
screenplay_version = args.tag
|
||||
else:
|
||||
screenplay_version = defines.SCREENPLAY_VERSION
|
||||
qt_ifw_version = defines.QT_IFW_VERSION # Not yet used.
|
||||
qt_version_overwrite: str
|
||||
use_aqt = False
|
||||
|
||||
tag = get_latest_git_tag()
|
||||
if tag:
|
||||
print(f"Latest Git tag: {tag}")
|
||||
semver = parse_semver(tag)
|
||||
if semver:
|
||||
print(f"Parsed SemVer: {semver}")
|
||||
screenplay_version = semver_to_string(semver)
|
||||
else:
|
||||
print("Failed to parse SemVer.")
|
||||
exit(-1)
|
||||
else:
|
||||
print("No git tags found.")
|
||||
exit(-1)
|
||||
|
||||
if args.qt_version_overwrite:
|
||||
qt_version = args.qt_version_overwrite
|
||||
print("Using Qt version {qt_version}")
|
||||
|
@ -1,9 +1,7 @@
|
||||
#!/usr/bin/python3
|
||||
# SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only
|
||||
import steam_publish
|
||||
import shutil
|
||||
import sys
|
||||
import macos_sign
|
||||
import argparse
|
||||
import os
|
||||
import build
|
||||
@ -11,18 +9,26 @@ from pathlib import Path
|
||||
import platform
|
||||
import paramiko
|
||||
import defines
|
||||
from util import sftp_exists, run, repo_root_path
|
||||
from util import sftp_exists, get_latest_git_tag, parse_semver, semver_to_string
|
||||
from sys import stdout
|
||||
|
||||
stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Build and Package ScreenPlay')
|
||||
parser.add_argument('-skip_publish', '-skp', action="store_true", dest="skip_publish", default=False, help="skip publish")
|
||||
parser.add_argument('-skip_build', '-skb', action="store_true", dest="skip_build", default=False, help="skip build. If we already have a build and only want to upload it")
|
||||
parser.add_argument('-steam_password', '-sp', action="store", dest="steam_password", help="Steam password")
|
||||
parser.add_argument('-hosting_username','-hu', action="store", dest="hosting_username", help="ssh username")
|
||||
parser.add_argument('-hosting_password', '-hp', action="store", dest="hosting_password", help="ssh password")
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Build and Package ScreenPlay')
|
||||
parser.add_argument('--skip_steam_publish', '-skstp', action="store_true",
|
||||
dest="skip_publish", default=False, help="skip publish")
|
||||
parser.add_argument('--skip_getspde_publish', '-skgsp', action="store_true",
|
||||
dest="skip_getspde_publish", default=False, help="skip getsp.de publish")
|
||||
parser.add_argument('--skip_build', '-skb', action="store_true", dest="skip_build",
|
||||
default=False, help="skip build. If we already have a build and only want to upload it")
|
||||
parser.add_argument('--steam_password', '-sp', action="store",
|
||||
dest="steam_password", help="Steam password")
|
||||
parser.add_argument('--hosting_username', '-hu', action="store",
|
||||
dest="hosting_username", help="ssh username")
|
||||
parser.add_argument('--hosting_password', '-hp', action="store",
|
||||
dest="hosting_password", help="ssh password")
|
||||
args = parser.parse_args()
|
||||
|
||||
# Script needs to run in the tools folder
|
||||
@ -31,10 +37,23 @@ if __name__ == "__main__":
|
||||
root_path = tools_path.parent
|
||||
print(f"Set root directory to: {root_path}")
|
||||
|
||||
tag = get_latest_git_tag()
|
||||
if tag:
|
||||
print(f"Latest Git tag: {tag}")
|
||||
semver = parse_semver(tag)
|
||||
if semver:
|
||||
print(f"Parsed SemVer: {semver}")
|
||||
screenplay_version = semver_to_string(semver)
|
||||
else:
|
||||
print("Failed to parse SemVer.")
|
||||
exit(-1)
|
||||
else:
|
||||
print("No git tags found.")
|
||||
exit(-1)
|
||||
|
||||
build_result = build.BuildResult()
|
||||
|
||||
build_config = build.BuildConfig()
|
||||
build_config.screenplay_version = defines.SCREENPLAY_VERSION
|
||||
build_config.qt_version = defines.QT_VERSION
|
||||
build_config.qt_ifw_version = defines.QT_IFW_VERSION
|
||||
build_config.build_steam = "ON"
|
||||
@ -42,6 +61,7 @@ if __name__ == "__main__":
|
||||
build_config.build_deploy = "ON"
|
||||
build_config.create_installer = "ON"
|
||||
build_config.build_type = "release"
|
||||
build_config.screenplay_version = screenplay_version
|
||||
|
||||
if platform.system() == "Darwin" and not args.skip_build:
|
||||
# We do not yet support a standalone osx installer
|
||||
@ -54,21 +74,21 @@ if __name__ == "__main__":
|
||||
# This will build both arm64 and x64 and sign the unversal binary
|
||||
build_result = build.execute(build_config)
|
||||
|
||||
|
||||
if platform.system() == "Windows" and not args.skip_build:
|
||||
build_config.build_architecture = "x64"
|
||||
|
||||
if not args.skip_publish:
|
||||
if not args.skip_getspde_publish:
|
||||
# Steamless version first
|
||||
build_config.build_steam = "OFF"
|
||||
build_result = build.execute(build_config)
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.load_system_host_keys()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect('kelteseth.com', username=args.hosting_username, password=args.hosting_password)
|
||||
ssh.connect('kelteseth.com', username=args.hosting_username,
|
||||
password=args.hosting_password)
|
||||
sftp = ssh.open_sftp()
|
||||
release_folder = "/kelteseth_com/public/releases/" + build_config.screenplay_version + "/"
|
||||
if sftp_exists(sftp,release_folder):
|
||||
release_folder = "/getsp.de/" + build_config.screenplay_version + "/"
|
||||
if sftp_exists(sftp, release_folder):
|
||||
remoteFiles = sftp.listdir(path=release_folder)
|
||||
for file in remoteFiles:
|
||||
print(f"Delte old: {release_folder+file}")
|
||||
@ -77,10 +97,14 @@ if __name__ == "__main__":
|
||||
sftp.mkdir(release_folder)
|
||||
print("Uploading files...")
|
||||
|
||||
sftp.put(build_result.build_zip, release_folder + str(build_result.build_zip.name))
|
||||
sftp.put(build_result.installer, release_folder + str(build_result.installer.name))
|
||||
sftp.put(build_result.installer_zip,release_folder + str(build_result.installer_zip.name))
|
||||
sftp.put(build_result.build_hash, release_folder + str(build_result.build_hash.name))
|
||||
sftp.put(build_result.build_zip, release_folder +
|
||||
str(build_result.build_zip.name))
|
||||
sftp.put(build_result.installer, release_folder +
|
||||
str(build_result.installer.name))
|
||||
sftp.put(build_result.installer_zip, release_folder +
|
||||
str(build_result.installer_zip.name))
|
||||
sftp.put(build_result.build_hash, release_folder +
|
||||
str(build_result.build_hash.name))
|
||||
sftp.close()
|
||||
ssh.close()
|
||||
|
||||
@ -90,8 +114,8 @@ if __name__ == "__main__":
|
||||
build_config.create_installer = "OFF"
|
||||
build_result = build.execute(build_config)
|
||||
|
||||
if args.skip_publish:
|
||||
print("Skip publishing.")
|
||||
if args.skip_steam_publish:
|
||||
print("Skip steam publishing.")
|
||||
sys.exit(0)
|
||||
|
||||
if args.steam_password is None:
|
||||
|
@ -18,7 +18,6 @@ elif sys.platform == "linux":
|
||||
OS = "linux"
|
||||
QT_PLATFORM = "gcc_64"
|
||||
|
||||
SCREENPLAY_VERSION = "0.15.1"
|
||||
QT_PATH = path = Path(os.path.join(
|
||||
os.path.realpath(__file__), "../../../aqt")).resolve()
|
||||
QT_VERSION = "6.5.2"
|
||||
|
@ -6,11 +6,13 @@ from pathlib import Path
|
||||
from os import chdir
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
from sys import stdout
|
||||
|
||||
stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
|
||||
def sftp_exists(sftp, path) -> bool:
|
||||
try:
|
||||
sftp.stat(path)
|
||||
@ -24,6 +26,7 @@ def run(cmd, cwd=Path.cwd()):
|
||||
if result.returncode != 0:
|
||||
raise RuntimeError(f"Failed to execute {cmd}")
|
||||
|
||||
|
||||
def run_and_capture_output(cmd, cwd=Path.cwd()) -> str:
|
||||
result = subprocess.run(cmd, shell=True, cwd=cwd, stdout=subprocess.PIPE)
|
||||
if result.returncode != 0:
|
||||
@ -32,11 +35,13 @@ def run_and_capture_output(cmd, cwd=Path.cwd()) -> str:
|
||||
return str(result.stdout.decode('utf-8'))
|
||||
return ""
|
||||
|
||||
|
||||
def repo_root_path() -> str:
|
||||
# Root dir of the repository
|
||||
path = os.path.join(os.path.realpath(__file__), "../../")
|
||||
return os.path.realpath(path)
|
||||
|
||||
|
||||
def cd_repo_root_path() -> str:
|
||||
# Make sure the script is always started from the same
|
||||
# ScreenPlay root folder
|
||||
@ -47,6 +52,7 @@ def cd_repo_root_path() -> str:
|
||||
chdir(root_path)
|
||||
return root_path
|
||||
|
||||
|
||||
def sha256(fname) -> str:
|
||||
hash_sha256 = hashlib.sha256()
|
||||
with open(fname, "rb") as f:
|
||||
@ -55,7 +61,6 @@ def sha256(fname) -> str:
|
||||
return hash_sha256.hexdigest()
|
||||
|
||||
|
||||
|
||||
def zipdir(path, ziph):
|
||||
# ziph is zipfile handle
|
||||
for root, dirs, files in os.walk(path):
|
||||
@ -102,3 +107,40 @@ def get_vs_env_dict():
|
||||
raise ValueError(stderr.decode("mbcs"))
|
||||
output = stdout.decode("mbcs").split("\r\n")
|
||||
return dict((e[0].upper(), e[1]) for e in [p.rstrip().split("=", 1) for p in output] if len(e) == 2)
|
||||
|
||||
|
||||
def get_latest_git_tag():
|
||||
try:
|
||||
tag = subprocess.check_output(
|
||||
["git", "describe", "--tags"]).decode("utf-8").strip()
|
||||
return tag
|
||||
except subprocess.CalledProcessError:
|
||||
print("Error fetching the Git tag.")
|
||||
return None
|
||||
|
||||
|
||||
def parse_semver(tag):
|
||||
# Regular expression to match semver
|
||||
# Like V0.15.0-RC1-305-g18b8c402
|
||||
# Do NOT add a - between RC and the version number (1 in this example)
|
||||
pattern = r'(?i)^v?(\d+)\.(\d+)\.(\d+)(?:-([a-z0-9.-]+))?(?:-(\d+)-g([a-f0-9]+))?$'
|
||||
match = re.match(pattern, tag)
|
||||
if match:
|
||||
major, minor, patch, pre_release, commits_since, commit_hash = match.groups()
|
||||
return {
|
||||
'major': major,
|
||||
'minor': minor,
|
||||
'patch': patch,
|
||||
'pre_release': pre_release,
|
||||
'commits_since': commits_since,
|
||||
'commit_hash': commit_hash
|
||||
}
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def semver_to_string(semver_dict):
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user