Updated scripts to be executed on CI environment

This commit is contained in:
Manuel Cortez 2020-07-27 09:44:04 -05:00
parent fd791fe181
commit 9481d2868f
2 changed files with 6 additions and 6 deletions

View File

@ -6,15 +6,15 @@ print("Generating update files for Socializer...")# Determine if we are going to
# Stable file is when we build tags and alpha otherwise. # Stable file is when we build tags and alpha otherwise.
version = os.environ.get("CI_COMMIT_TAG") or os.environ.get("CI_COMMIT_SHORT_SHA") version = os.environ.get("CI_COMMIT_TAG") or os.environ.get("CI_COMMIT_SHORT_SHA")
if os.environ.get("CI_COMMIT_TAG") == None: if os.environ.get("CI_COMMIT_TAG") == None:
version_type = "alpha" version_type = "latest"
else: else:
version_type = "stable" version_type = "stable"
print("Version detected: %s" % (version_type,)) print("Version detected: %s" % (version_type,))
# Read update description and URL'S # Read update description and URL'S
if version_type == "alpha": if version_type == "latest":
description = os.environ.get("CI_COMMIT_MESSAGE") description = os.environ.get("CI_COMMIT_MESSAGE")
urls = dict(Windows32="https://manuelcortez.net/static/files/music_dl/alpha/music_dl.zip", Windows64="https://manuelcortez.net/static/files/music_dl/alpha/music_dl.zip") urls = dict(Windows32="https://manuelcortez.net/static/files/music_dl/latest/music_dl.zip", Windows64="https://manuelcortez.net/static/files/music_dl/latest/music_dl.zip")
else: else:
with open("update-description",'r') as f: with open("update-description",'r') as f:
description = f.read() description = f.read()
@ -23,8 +23,8 @@ else:
# build the main dict object # build the main dict object
data = dict(current_version=version, description=description, downloads=urls) data = dict(current_version=version, description=description, downloads=urls)
print("Generating file with the following arguments: %r" % (data,)) print("Generating file with the following arguments: %r" % (data,))
if version_type == "alpha": if version_type == "latest":
updatefile = "alpha.json" updatefile = "latest.json"
else: else:
updatefile = "stable.json" updatefile = "stable.json"
f = open(updatefile, "w") f = open(updatefile, "w")

View File

@ -47,7 +47,7 @@ def callback(progress):
ftp_server = os.environ.get("FTP_SERVER") or sys.argv[1] ftp_server = os.environ.get("FTP_SERVER") or sys.argv[1]
ftp_username = os.environ.get("FTP_USERNAME") or sys.argv[2] ftp_username = os.environ.get("FTP_USERNAME") or sys.argv[2]
ftp_password = os.environ.get("FTP_PASSWORD") or sys.argv[3] ftp_password = os.environ.get("FTP_PASSWORD") or sys.argv[3]
version = os.environ.get("CI_COMMIT_TAG") or "alpha" version = os.environ.get("CI_COMMIT_TAG") or "latest"
version = version.replace("v", "") version = version.replace("v", "")
print("Uploading files to the Socializer server...") print("Uploading files to the Socializer server...")