| 5 |
| APK_VERSION_RE = re.compile(r"-v(?P<name>.+)\((?P<code>\d+)\)-[^/]+\.apk$") |
| 6 |
| 7 |
| 8 | def read_apk_version(path: Path) -> tuple[str, int]: |
| 9 | match = APK_VERSION_RE.search(path.name) |
| 10 | if match is None: |
| 11 | raise ValueError(f"Cannot read version from APK filename: {path.name}") |
| 12 | return match.group("name"), int(match.group("code")) |
| 13 |
| 14 |
| 15 | if __name__ == "__main__": |
| 16 | # Printed as step outputs: the channel post takes its heading from them. |
| 17 | version_name, version_code = read_apk_version(Path(argv[1])) |
| 18 | print(f"version={version_name}") |
| 19 | print(f"build={version_code}") |
| 20 |