refactor(build): 统一本地与 CI 构建入口及平台发布工具 (#9)
Gitea CI / Check code and tests (push) Successful in 7m38s
Gitea CI / Build Android APK (push) Successful in 6m20s
Gitea CI / Audit and package Windows x64 (push) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (push) Canceled after 0s
Gitea CI / Gitea CI passed (push) Canceled after 0s
Gitea CI / Build Windows x64 app (push) Canceled after 14m42s

This commit was merged in pull request #9.
This commit is contained in:
lingjhf committed 2026-10-06 16:14:42 +00:00
1 parent a13a54d5ec
commit 4a759d81a6
61 files changed
+1913 -388

No files matched your search

+11 -8
View File
@@ -6,11 +6,14 @@ from pathlib import Path
import plistlib
import re
import shutil
import subprocess
import sys
import tempfile
from urllib.parse import urlsplit
import xml.etree.ElementTree as ET
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from common.process import cli, run
SPARKLE = 'http://www.andymatuschak.org/xml-namespaces/sparkle'
@@ -65,10 +68,10 @@ def validate_app(app, local=False):
for file in ['Sparkle', 'Autoupdate', 'Updater.app/Contents/MacOS/Updater']:
if not (framework / file).is_file():
raise ValueError(f'Missing Sparkle component: {file}')
subprocess.run(['codesign', '--verify', '--deep', '--strict', str(app)], check=True)
run(['codesign', '--verify', '--deep', '--strict', str(app)], cwd=Path.cwd(), check=True)
if not local:
subprocess.run(['xcrun', 'stapler', 'validate', str(app)], check=True)
subprocess.run(['spctl', '--assess', '--type', 'execute', str(app)], check=True)
run(['xcrun', 'stapler', 'validate', str(app)], cwd=Path.cwd(), check=True)
run(['spctl', '--assess', '--type', 'execute', str(app)], cwd=Path.cwd(), check=True)
return info
@@ -108,14 +111,14 @@ def publish(app, output, base_url, tools, key_file=None, local=False):
raise ValueError(f'Refusing to replace published archive: {archive}')
with tempfile.TemporaryDirectory(prefix='cutdex-update-') as directory:
stage = Path(directory)
subprocess.run(['ditto', '-c', '-k', '--sequesterRsrc', '--keepParent',
str(app), str(stage / filename)], check=True)
run(['ditto', '-c', '-k', '--sequesterRsrc', '--keepParent',
str(app), str(stage / filename)], cwd=Path.cwd(), check=True)
command = [str(tools / 'generate_appcast'), '--maximum-deltas', '0',
'--download-url-prefix', base_url.rstrip('/') + '/',
'-o', str(stage / 'appcast.xml')]
if key_file:
command.extend(['--ed-key-file', str(key_file)])
subprocess.run([*command, str(stage)], check=True)
run([*command, str(stage)], cwd=Path.cwd(), check=True)
tree = ET.parse(stage / 'appcast.xml')
if tree.findall(f'.//{{{SPARKLE}}}deltas'):
raise ValueError('This release pipeline only permits full updates')
@@ -154,4 +157,4 @@ def main():
if __name__ == '__main__':
main()
sys.exit(cli(main))