Generate update files with right version

This commit is contained in:
Manuel Cortez 2022-03-25 12:58:13 -06:00
parent 0ea41cea89
commit 6eaa0f50a1
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790

View File

@ -1,32 +1,21 @@
#! /usr/bin/env python #! /usr/bin/env python
import os import os
import json import json
import datetime
print("Generating update files for Socializer...")# Determine if we are going to write stable or alpha update file. print("Generating update files for Socializer...")# Determine if we are going to write stable or alpha update file.
# Stable file is when we build tags and alpha otherwise. version = datetime.datetime.now().strftime("%Y.%m.%D")
version = os.environ.get("CI_COMMIT_TAG") or os.environ.get("CI_COMMIT_SHORT_SHA") version_type = "latest"
if os.environ.get("CI_COMMIT_TAG") == None:
version_type = "latest"
else:
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 == "latest": description = os.environ.get("CI_COMMIT_MESSAGE")
description = os.environ.get("CI_COMMIT_MESSAGE") urls = dict(Windows32="https://files.mcvsoftware.com/music_dl/latest/music_dl_x86.zip", Windows64="https://files.mcvsoftware.com/music_dl/latest/music_dl_x64.zip")
urls = dict(Windows32="https://files.mcvsoftware.com/music_dl/latest/music_dl_x86.zip", Windows64="https://files.mcvsoftware.com/music_dl/latest/music_dl_x64.zip")
else:
with open("update-description",'r') as f:
description = f.read()
urls=dict(Windows32="https://manuelcortez.net/static/files/{v}/music_dl_{v}.zip".format(v=version[1:]), Windows64="http://socializer.su/static/files/{v}/socializer_{v}_x64.zip".format(v=version[1:]))
# 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 == "latest": updatefile = "latest.json"
updatefile = "latest.json"
else:
updatefile = "stable.json"
f = open(updatefile, "w") f = open(updatefile, "w")
json.dump(data, f, ensure_ascii=False) json.dump(data, f, ensure_ascii=False)
f.close() f.close()