Upload generated packages on `tmp/ci` when building on branches.

We need to be able to test our generated artefacts before we merge the
branches.
This commit is contained in:
Matthieu Gautier 2022-11-16 11:24:17 +01:00
parent ab421848c5
commit a44531bb8a
2 changed files with 18 additions and 6 deletions

View File

@ -6,9 +6,11 @@ from common import (
make_archive,
create_desktop_image,
fix_macos_rpath,
upload_archive,
OS_NAME,
PLATFORM_TARGET,
DESKTOP,
DEV_BRANCH,
)
if (PLATFORM_TARGET.startswith("android_")
@ -40,8 +42,10 @@ else:
for target in TARGETS:
run_kiwix_build(target, platform=PLATFORM_TARGET)
if target == "kiwix-desktop":
create_desktop_image(make_release=False)
archive = create_desktop_image(make_release=False)
else:
if PLATFORM_TARGET == "native_mixed" and OS_NAME == "osx":
fix_macos_rpath(target)
make_archive(target, make_release=False)
archive = make_archive(target, make_release=False)
if archive:
upload_archive(archive, target, make_release=False, dev_branch=DEV_BRANCH)

View File

@ -39,6 +39,11 @@ _ref = _environ.get("GITHUB_REF", "").split("/")[-1]
MAKE_RELEASE = re.fullmatch(r"r_[0-9]+", _ref) is not None
MAKE_RELEASE = MAKE_RELEASE and (_environ.get('GITHUB_EVENT_NAME') != 'schedule')
if not MAKE_RELEASE and _ref != "master":
DEV_BRANCH = _ref
else:
DEV_BRANCH = None
RELEASE_OS_NAME = "macos" if OS_NAME == "osx" else "linux"
PLATFORM_TO_RELEASE = {
@ -227,7 +232,7 @@ def upload(file_to_upload, host, dest_path):
subprocess.check_call(command)
def upload_archive(archive, project, make_release):
def upload_archive(archive, project, make_release, dev_branch=None):
if not archive.exists():
print_message("No archive {} to upload!", archive)
return
@ -244,9 +249,12 @@ def upload_archive(archive, project, make_release):
else:
dest_path = dest_path + "nightly/" + DATE
# Make the archive read only. This way, scp will preserve rights.
# If somehow we try to upload twice the same archive, scp will fails.
archive.chmod(0o444)
if dev_branch:
dest_path = "/data/tmp/ci/" + dev_branch
else:
# Make the archive read only. This way, scp will preserve rights.
# If somehow we try to upload twice the same archive, scp will fails.
archive.chmod(0o444)
upload(archive, host, dest_path)