diff --git a/apps/mobile/.release-it.ts b/apps/mobile/.release-it.ts index bbfb70a..ed7c1d1 100644 --- a/apps/mobile/.release-it.ts +++ b/apps/mobile/.release-it.ts @@ -32,7 +32,7 @@ export default { hooks: { 'before:init': ['turbo run lint:check'], - 'before:github:release': 'pnpm run build:signed:apk', + 'before:github:release': 'turbo run build:signed:apk', 'after:release': 'echo "Released ${npm.name} v${version}"', }, diff --git a/apps/mobile/scripts/signed-build.ts b/apps/mobile/scripts/signed-build.ts index a13f3c3..49a1bb6 100644 --- a/apps/mobile/scripts/signed-build.ts +++ b/apps/mobile/scripts/signed-build.ts @@ -13,6 +13,14 @@ async function getSecrets(): Promise<{ keystoreAlias: string; keystorePassword: string; }> { + const isBwUnlocked = await cmd(`bw status`, { stdio: 'pipe' }).then( + ({ stdout }) => { + const bwStatus = JSON.parse(stdout) as { status: string }; + return bwStatus.status === 'unlocked'; + }, + ); + if (!isBwUnlocked) throw new Error('Bitwarden is not unlocked'); + const { stdout: rawBwItemString } = await cmd( `bw get item "fressh keystore" --raw`, { diff --git a/apps/mobile/turbo.jsonc b/apps/mobile/turbo.jsonc index 35164f3..975f786 100644 --- a/apps/mobile/turbo.jsonc +++ b/apps/mobile/turbo.jsonc @@ -28,5 +28,6 @@ // Special tasks "expo:doctor": {}, "test:e2e": {}, + "build:signed:apk": {}, }, } diff --git a/turbo.jsonc b/turbo.jsonc index 9126a4c..16848f2 100644 --- a/turbo.jsonc +++ b/turbo.jsonc @@ -6,6 +6,7 @@ "ANDROID_*", "SSL_CERT_FILE", "GRADLE_OPTS", + "BW_SESSION", ], "tasks": { // Defaults