Add a option to deactivate APKs upload to android play store.

APKs are pushed to a http accessible address.
This is needed as first association of APKs to an application must be
made manually.
This commit is contained in:
Matthieu Gautier 2017-06-07 10:29:41 +02:00
parent 22fffcee51
commit 71650ffebd
3 changed files with 69 additions and 53 deletions

View File

@ -53,6 +53,7 @@ def parse_args():
advance = parser.add_argument_group('advance', "Some advanced options.") advance = parser.add_argument_group('advance', "Some advanced options.")
advance.add_argument('--extra-code', type=int, default=0) advance.add_argument('--extra-code', type=int, default=0)
advance.add_argument('--check-certificate', default=True) advance.add_argument('--check-certificate', default=True)
advance.add_argument('--no-android-upload', action='store_false', dest='android_upload')
# Hidden options # Hidden options
parser.add_argument('--step', default='launch', choices=['launch', 'publish'], help=argparse.SUPPRESS) parser.add_argument('--step', default='launch', choices=['launch', 'publish'], help=argparse.SUPPRESS)
@ -163,7 +164,6 @@ def travis_launch_build(organisation, repository, options, zim_size):
{ 'PACKAGE_NAME': options.package_name}, { 'PACKAGE_NAME': options.package_name},
{ 'ZIM_URL': options.zim_url}, { 'ZIM_URL': options.zim_url},
{ 'EXTRA_CODE': options.extra_code}, { 'EXTRA_CODE': options.extra_code},
{ 'BASE_VERSION': options.base_version},
{ 'CONTENT_VERSION_CODE': gen_version_code(0, options.base_version)}, { 'CONTENT_VERSION_CODE': gen_version_code(0, options.base_version)},
{ 'VERSION': options.version}, { 'VERSION': options.version},
{ 'secure': ('u6MCvCQhAlvU0jNojLVatNXHr6AYj4rjU9CY9JcUUG9CKMsls1t3ERz' { 'secure': ('u6MCvCQhAlvU0jNojLVatNXHr6AYj4rjU9CY9JcUUG9CKMsls1t3ERz'
@ -229,8 +229,13 @@ def travis_launch_build(organisation, repository, options, zim_size):
'on': { 'on': {
'branch': 'custom_app' 'branch': 'custom_app'
} }
}, }
'jobs': { }
}
}
if options.android_upload:
data['request']['config']['jobs'] = {
'include': [ 'include': [
{ {
'stage' : 'make_release', 'stage' : 'make_release',
@ -248,9 +253,15 @@ def travis_launch_build(organisation, repository, options, zim_size):
} }
] ]
} }
} global_env.append({
} 'DEPLOY_DIR' : '/home/nightlybot/apks/{}_{}'.format(
} options.custom_app, options.base_version)
})
else:
global_env.append({
'DEPLOY_DIR' : '/var/www/tmp.kiwix.org/custom_apps/{}_{}'.format(
options.custom_app, options.base_version)
})
r = requests.post(request_url, headers=headers, json=data) r = requests.post(request_url, headers=headers, json=data)
@ -293,6 +304,11 @@ def travis_launch_build(organisation, repository, options, zim_size):
"the associated build. Have a look here " "the associated build. Have a look here "
"https://travis-ci.org/kiwix/kiwix-build/builds" "https://travis-ci.org/kiwix/kiwix-build/builds"
"if you found it.") "if you found it.")
if not options.android_upload:
print(("Automatic upload to android play store has been deactivated.\n"
"You will find the apks at this address once they have been compiled :"
" http://tmp.kiwix.org/custom_apps/{}_{}").format(
options.custom_app, options.base_version))
ERROR_MSG_EDIT_CHANGE = "A change was made to the application outside of this Edit, please create a new edit." ERROR_MSG_EDIT_CHANGE = "A change was made to the application outside of this Edit, please create a new edit."

View File

@ -20,8 +20,8 @@ TOOLCHAINS/android-sdk-r25.2.3/build-tools/25.0.2/apksigner sign \
--out ${SIGNED_APK} \ --out ${SIGNED_APK} \
${INPUT_APK_FILE} ${INPUT_APK_FILE}
ssh -i ${SSH_KEY} nightlybot@download.kiwix.org "mkdir -p ~/apks/${CUSTOM_APP}_${BASE_VERSION}" ssh -i ${SSH_KEY} nightlybot@download.kiwix.org "mkdir -p ${DEPLOY_DIR}"
scp -i ${SSH_KEY} \ scp -i ${SSH_KEY} \
${SIGNED_APK} \ ${SIGNED_APK} \
nightlybot@download.kiwix.org:~/apks/${CUSTOM_APP}_${BASE_VERSION} nightlybot@download.kiwix.org:${DEPLOY_DIR}

View File

@ -13,9 +13,9 @@ BASE_DIR="BUILD_${PLATFORM}"
mkdir -p ${HOME}/APKS mkdir -p ${HOME}/APKS
scp -i ${SSH_KEY} nightlybot@download.kiwix.org:~/apks/${CUSTOM_APP}_${BASE_VERSION}/* ${HOME}/APKS scp -i ${SSH_KEY} nightlybot@download.kiwix.org:${DEPLOY_DIR}/* ${HOME}/APKS
ssh -i ${SSH_KEY} nightlybot@download.kiwix.org "rm -rf ~/apks/${CUSTOM_APP}_${BASE_VERSION}" ssh -i ${SSH_KEY} nightlybot@download.kiwix.org "rm -rf ${DEPLOY_DIR}"
${TRAVIS_BUILD_DIR}/build_custom_app.py \ ${TRAVIS_BUILD_DIR}/build_custom_app.py \
--step publish \ --step publish \