Add appcenter

This commit is contained in:
Ali 2022-08-11 03:05:31 +04:00
parent a207846767
commit 5572a4e030
4 changed files with 78 additions and 6 deletions

View File

@ -56,6 +56,7 @@ experimental_i:
- tags - tags
script: script:
- PYTHONPATH="$PYTHONPATH:/darwin-containers" python3 -u build-system/Make/Make.py remote-build --darwinContainersHost="http://host.docker.internal:8650" --cacheHost="$TELEGRAM_BAZEL_CACHE_HOST" --configurationPath=build-system/appstore-configuration.json --gitCodesigningRepository="$TELEGRAM_GIT_CODESIGNING_REPOSITORY" --gitCodesigningType=appstore --configuration=release_arm64 - PYTHONPATH="$PYTHONPATH:/darwin-containers" python3 -u build-system/Make/Make.py remote-build --darwinContainersHost="http://host.docker.internal:8650" --cacheHost="$TELEGRAM_BAZEL_CACHE_HOST" --configurationPath=build-system/appstore-configuration.json --gitCodesigningRepository="$TELEGRAM_GIT_CODESIGNING_REPOSITORY" --gitCodesigningType=appstore --configuration=release_arm64
- python3 -u build-system/Make/DeployYoAppCenter.py --configuration="$TELEGRAM_PRIVATE_DATA_PATH/appcenter-configurations/appcenter-experimental.json" --ipa="build/artifacts/Telegram.ipa" --dsyms="build/artifacts/Telegram.DSYMs.zip"
environment: environment:
name: experimental name: experimental
artifacts: artifacts:

View File

@ -5,12 +5,7 @@ import shutil
import tempfile import tempfile
import plistlib import plistlib
from BuildEnvironment import run_executable_with_output from BuildEnvironment import run_executable_with_output, check_run_system
def check_run_system(command):
if os.system(command) != 0:
print('Command failed: {}'.format(command))
sys.exit(1)
class BuildConfiguration: class BuildConfiguration:
def __init__(self, def __init__(self,

View File

@ -83,6 +83,12 @@ def call_executable(arguments, use_clean_environment=True, check_result=True):
subprocess.call(resolved_arguments, env=resolved_env) subprocess.call(resolved_arguments, env=resolved_env)
def check_run_system(command):
if os.system(command) != 0:
print('Command failed: {}'.format(command))
sys.exit(1)
def get_bazel_version(bazel_path): def get_bazel_version(bazel_path):
command_result = run_executable_with_output(bazel_path, ['--version']).strip('\n') command_result = run_executable_with_output(bazel_path, ['--version']).strip('\n')
if not command_result.startswith('bazel '): if not command_result.startswith('bazel '):

View File

@ -0,0 +1,70 @@
import os
import sys
import argparse
import json
from BuildEnvironment import check_run_system
def deploy_to_appcenter(args):
if not os.path.exists(args.configuration):
print('{} does not exist'.format(args.configuration))
sys.exit(1)
if not os.path.exists(args.ipa):
print('{} does not exist'.format(args.ipa))
sys.exit(1)
if args.dsyms is not None and not os.path.exists(args.dsyms):
print('{} does not exist'.format(args.dsyms))
sys.exit(1)
with open(args.configuration) as file:
configuration_dict = json.load(file)
required_keys = [
'username',
'app_name',
'api_token',
]
for key in required_keys:
if key not in configuration_dict:
print('Configuration at {} does not contain {}'.format(args.configuration, key))
check_run_system('appcenter login --token {token}'.format(token=configuration_dict['api_token']))
check_run_system('appcenter distribute release --app "{username}/{app_name}" -f "{ipa_path}" -g Internal'.format(
username=configuration_dict['username'],
app_name=configuration_dict['app_name'],
ipa_path=args.ipa,
))
if args.dsyms is not None:
check_run_system('appcenter crashes upload-symbols --app "{username}/{app_name}" --symbol "{dsym_path}"'.format(
username=configuration_dict['username'],
app_name=configuration_dict['app_name'],
dsym_path=args.dsyms
))
if __name__ == '__main__':
parser = argparse.ArgumentParser(prog='deploy-appcenter')
parser.add_argument(
'--configuration',
required=True,
help='Path to configuration json.'
)
parser.add_argument(
'--ipa',
required=True,
help='Path to IPA.'
)
parser.add_argument(
'--dsyms',
required=False,
help='Path to DSYMs.zip.'
)
if len(sys.argv) < 2:
parser.print_help()
sys.exit(1)
args = parser.parse_args()
deploy_to_appcenter(args)