|
23 | 23 | WINDOWS_LEGACY_INSTALLER_RE = re.compile( |
24 | 24 | r"(?P<name>.+?)_(?P<version>.+?)_(?P<arch>x64|amd64|arm64|aarch64)-setup\.exe$" |
25 | 25 | ) |
| 26 | +LEGACY_NIGHTLY_VERSION_RE = re.compile( |
| 27 | + rf"^(?P<version>.+?)-nightly[._-](?P<date>[0-9]{{8}})[._-](?P<sha>{SHORT_SHA_PATTERN})$" |
| 28 | +) |
26 | 29 |
|
27 | 30 | PORTABLE_README_NAME = "README-portable.txt" |
28 | 31 | PORTABLE_README_TEXT = """AstrBot Windows portable package |
@@ -119,7 +122,12 @@ def installer_to_portable_name(installer_name: str) -> str: |
119 | 122 | name = legacy_match.group("name") |
120 | 123 | version = legacy_match.group("version") |
121 | 124 | arch = normalize_arch(legacy_match.group("arch")) |
122 | | - return f"{name}_{version}_windows_{arch}_portable.zip" |
| 125 | + nightly_suffix = "" |
| 126 | + nightly_match = LEGACY_NIGHTLY_VERSION_RE.fullmatch(version) |
| 127 | + if nightly_match: |
| 128 | + version = nightly_match.group("version") |
| 129 | + nightly_suffix = f"_nightly_{nightly_match.group('sha')}" |
| 130 | + return f"{name}_{version}_windows_{arch}_portable{nightly_suffix}.zip" |
123 | 131 |
|
124 | 132 | raise ValueError( |
125 | 133 | "Unexpected Windows installer name: " |
@@ -203,9 +211,10 @@ def populate_portable_root( |
203 | 211 | ) -> None: |
204 | 212 | release_dir = resolve_release_dir(bundle_dir) |
205 | 213 | main_executable_path = resolve_main_executable_path(bundle_dir, project_config) |
| 214 | + portable_executable_name = f"{project_config.product_name}.exe" |
206 | 215 |
|
207 | 216 | destination_root.mkdir(parents=True, exist_ok=True) |
208 | | - shutil.copy2(main_executable_path, destination_root / main_executable_path.name) |
| 217 | + shutil.copy2(main_executable_path, destination_root / portable_executable_name) |
209 | 218 |
|
210 | 219 | webview_loader = release_dir / "WebView2Loader.dll" |
211 | 220 | if webview_loader.is_file(): |
|
0 commit comments