提交 ef7036d4 编写于 作者: J Jonathan Thomas

Renaming release candidate files before uploading artifacts

上级 d3198e38
......@@ -30,6 +30,7 @@ import sys
import datetime
import platform
import traceback
import re
from github3 import login
from requests.auth import HTTPBasicAuth
from requests import post, get
......@@ -37,6 +38,7 @@ from build_server import output, run_command, error, truncate, zulip_upload_log,
errors_detected, log, version_info, parse_version_info
PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) # Primary openshot folder
RELEASE_NAME_REGEX = re.compile(r'^OpenShot-v.*?(-.*?)\.')
# Access info class (for version info)
sys.path.append(os.path.join(PATH, 'src', 'classes'))
......@@ -163,9 +165,23 @@ if __name__ == "__main__":
# NOTE: ONLY for `openshot-qt` repo
# github_release_url = github_release.html_url
github_release = releases.get('openshot-qt')
for artifact_name in os.listdir(artifact_dir):
artifact_path = os.path.join(artifact_dir, artifact_name)
if os.path.exists(artifact_path) and os.path.splitext(artifact_name)[-1] in ['.exe', '.dmg', '.AppImage', '.torrent']:
for artifact_orig_name in os.listdir(artifact_dir):
artifact_path_orig = os.path.join(artifact_dir, artifact_orig_name)
match = RELEASE_NAME_REGEX.match(artifact_orig_name)
if match and match.groups():
# Rename artifact before uploading
file_name_pattern = match.groups()[0]
artifact_name = artifact_orig_name.replace(file_name_pattern, "")
artifact_path = os.path.join(artifact_dir, artifact_name)
os.rename(artifact_path_orig, artifact_path)
else:
# Leave artifact with the original name
artifact_name = artifact_orig_name
artifact_path = artifact_path_orig
artifact_base, artifact_ext = os.path.splitext(artifact_name)
if os.path.exists(artifact_path) and artifact_ext in ['.exe', '.dmg', '.AppImage', '.torrent',
'.verify', '.sha256sum']:
# Valid artifact/installer - Upload to GitHub Release
output("GitHub: Uploading %s to GitHub Release: %s" % (artifact_path, github_release.tag_name))
download_url = upload(artifact_path, github_release)
......
......@@ -32,7 +32,6 @@ import datetime
PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) # Primary openshot folder
sys.path.append(os.path.join(PATH, 'src', 'classes'))
import info
def parse_version_info(version_path):
......@@ -68,9 +67,6 @@ def parse_build_name(version_info, git_branch_name=""):
if git_branch_name.startswith("release"):
# Release candidate
release_label = "release-candidate"
elif git_branch_name == "master":
# Release
release_label = ""
else:
# Daily
release_label = "daily"
......@@ -80,7 +76,7 @@ def parse_build_name(version_info, git_branch_name=""):
if release_label:
# Daily and Release Candidates
build_name = "OpenShot-v%s-%s-%s-%s-%s" % (
info.VERSION,
version_info.get('openshot-qt', {}).get('VERSION'),
release_label,
version_info.get('openshot-qt', {}).get('CI_PIPELINE_ID', 'NA'),
version_info.get('libopenshot', {}).get('CI_COMMIT_SHA', 'NA')[:8],
......@@ -88,7 +84,7 @@ def parse_build_name(version_info, git_branch_name=""):
)
else:
# Official releases
build_name = "OpenShot-v%s" % info.VERSION
build_name = "OpenShot-v%s" % version_info.get('openshot-qt', {}).get('VERSION')
return build_name
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册