/** * What the release asks custos-sign to do with the Android APK (fabrica-release.md F4). Kept * apart from the script that runs it so the arguments can be tested without Custos. * * The key `rosea-domi-android` lives in Custos only (Mark made it under that name, 2026-12-02); * custos-sign holds no key material either. Its scope is exactly `mnovak/Rosea`, the release * pipeline, a tag. The name is forever: an APK signed with it is Rosea on Android for good. */ export const APK_KEY = 'rosea-domi-android'; export const REPO = 'mnovak/Rosea'; /** Where Gradle leaves the release APK of `tauri android build --apk --target aarch64`, from src-tauri. */ export const UNSIGNED_APK = 'gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned.apk'; /** The published APK's name: the app, the version, the one ABI it is built for. */ export const signedApkName = (version: string): string => `rosea-domi-${version}-arm64.apk`; export interface SignRequest { readonly version: string; readonly commit: string; readonly unsigned: string; readonly out: string; } /** The arguments of `custos-sign apk`, or the reason they cannot be made. */ export function signArgs(r: SignRequest): string[] { if (!/^\d+\.\d+\.\d+$/.test(r.version)) throw new Error(`not a version: ${r.version}`); if (!/^[0-9a-f]{40}$/.test(r.commit)) throw new Error(`not a commit: ${r.commit}`); return [ 'apk', r.unsigned, '--out', r.out, '--key', APK_KEY, '--repo', REPO, '--pipeline', 'release', '--commit', r.commit, '--trigger', 'tag', '--run', `rosea-v${r.version}`, '--version', r.version, '--step', 'apk' ]; } /** * Which custos-sign to run. `CUSTOS_SIGN_EXE` names it; when it names a file that is not there, * the release refuses rather than run another one from PATH. `CUSTOS_PIPE` is refused: a signed * run must reach Mark's Custos, never a test instance whose key is nobody's. */ export function custosSign(env: Readonly>, exists: (p: string) => boolean): string { if (env['CUSTOS_PIPE']) throw new Error('CUSTOS_PIPE is set: the APK would be signed by another Custos than Mark\'s'); const named = env['CUSTOS_SIGN_EXE']; if (named === undefined || named === '') return 'custos-sign.exe'; if (!exists(named)) throw new Error(`CUSTOS_SIGN_EXE names ${named}, which is not there`); return named; }