From 7c07ceb8b19959152f9fb588c68e7a9f2558863f Mon Sep 17 00:00:00 2001 From: Ali <> Date: Thu, 11 Aug 2022 21:12:03 +0400 Subject: [PATCH] Temp --- .gitlab-ci.yml | 16 ++--- build-system/Make/BuildConfiguration.py | 4 +- build-system/Make/DeployToAppStoreConnect.py | 62 ++++++++++++++++++++ 3 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 build-system/Make/DeployToAppStoreConnect.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 26e84d4925..46308d2fb0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,8 +18,8 @@ internal: except: - tags script: - - bash buildbox/build-telegram.sh hockeyapp - - bash buildbox/deploy-telegram.sh hockeyapp + - 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="$TELEGRAM_PRIVATE_DATA_PATH/build-configurations/enterprise-configuration.json" --gitCodesigningRepository="$TELEGRAM_GIT_CODESIGNING_REPOSITORY" --gitCodesigningType=enterprise --configuration=release_arm64 + - python3 -u build-system/Make/DeployToAppCenter.py --configuration="$TELEGRAM_PRIVATE_DATA_PATH/appcenter-configurations/appcenter-internal.json" --ipa="build/artifacts/Telegram.ipa" --dsyms="build/artifacts/Telegram.DSYMs.zip" environment: name: internal artifacts: @@ -37,8 +37,8 @@ appstore_development: except: - tags script: - - bash buildbox/build-telegram.sh appstore-development - - bash buildbox/deploy-telegram.sh appstore-development + - 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="$TELEGRAM_PRIVATE_DATA_PATH/build-configurations/enterprise-configuration.json" --gitCodesigningRepository="$TELEGRAM_GIT_CODESIGNING_REPOSITORY" --gitCodesigningType=enterprise --configuration=release_arm64 + - python3 -u build-system/Make/DeployToAppCenter.py --configuration="$TELEGRAM_PRIVATE_DATA_PATH/appcenter-configurations/appstore-development.json" --ipa="build/artifacts/Telegram.ipa" --dsyms="build/artifacts/Telegram.DSYMs.zip" environment: name: appstore-development artifacts: @@ -55,7 +55,7 @@ experimental_i: except: - tags 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="$TELEGRAM_PRIVATE_DATA_PATH/build-configurations/enterprise-configuration.json" --gitCodesigningRepository="$TELEGRAM_GIT_CODESIGNING_REPOSITORY" --gitCodesigningType=enterprise --configuration=release_arm64 - python3 -u build-system/Make/DeployToAppCenter.py --configuration="$TELEGRAM_PRIVATE_DATA_PATH/appcenter-configurations/appcenter-experimental.json" --ipa="build/artifacts/Telegram.ipa" --dsyms="build/artifacts/Telegram.DSYMs.zip" environment: name: experimental @@ -73,8 +73,8 @@ experimental: except: - tags script: - - bash buildbox/build-telegram.sh appcenter-experimental-2 - - bash buildbox/deploy-telegram.sh appcenter-experimental-2 + - 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="$TELEGRAM_PRIVATE_DATA_PATH/build-configurations/enterprise-configuration.json" --gitCodesigningRepository="$TELEGRAM_GIT_CODESIGNING_REPOSITORY" --gitCodesigningType=enterprise --configuration=release_arm64 + - python3 -u build-system/Make/DeployToAppCenter.py --configuration="$TELEGRAM_PRIVATE_DATA_PATH/appcenter-configurations/appcenter-experimental2.json" --ipa="build/artifacts/Telegram.ipa" --dsyms="build/artifacts/Telegram.DSYMs.zip" environment: name: experimental-2 artifacts: @@ -92,7 +92,7 @@ beta_testflight: except: - tags script: - - bash buildbox/build-telegram.sh appstore + - 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_universal environment: name: testflight_llc artifacts: diff --git a/build-system/Make/BuildConfiguration.py b/build-system/Make/BuildConfiguration.py index c27e191205..9bd933f4ee 100644 --- a/build-system/Make/BuildConfiguration.py +++ b/build-system/Make/BuildConfiguration.py @@ -244,8 +244,10 @@ class GitCodesigningSource(CodesigningSource): def copy_certificates_to_destination(self, destination_path): source_path = None - if self.codesigning_type in ['adhoc', 'appstore', 'enterprise']: + if self.codesigning_type in ['adhoc', 'appstore']: source_path = self.working_dir + '/decrypted/certs/distribution' + elif self.codesigning_type == 'enterprise': + source_path = self.working_dir + '/decrypted/certs/enterprise' elif self.codesigning_type == 'development': source_path = self.working_dir + '/decrypted/certs/development' else: diff --git a/build-system/Make/DeployToAppStoreConnect.py b/build-system/Make/DeployToAppStoreConnect.py new file mode 100644 index 0000000000..83fd892729 --- /dev/null +++ b/build-system/Make/DeployToAppStoreConnect.py @@ -0,0 +1,62 @@ +import os +import sys +import argparse +import json + +from BuildEnvironment import check_run_system + +def deploy_to_appstore_connect(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) + + 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-appstore-connect') + + parser.add_argument( + '--configuration', + required=True, + help='Path to configuration json.' + ) + parser.add_argument( + '--ipa', + required=True, + help='Path to IPA.' + ) + + if len(sys.argv) < 2: + parser.print_help() + sys.exit(1) + + args = parser.parse_args() + + deploy_to_appstore_connect(args)