idk
All checks were successful
Build and Release / build-and-release (push) Successful in 15m4s

This commit is contained in:
Bryan1029384756
2026-02-18 18:38:36 -06:00
parent e7cde6dd3b
commit 65fa715fdf

View File

@@ -109,26 +109,30 @@ jobs:
npx cap add android
echo "sdk.dir=${ANDROID_SDK_ROOT}" > android/local.properties
# Inject signing config into the generated build.gradle
# Append a merged android block with signingConfigs + buildTypes.release signing
# Gradle merges multiple android {} blocks, and within one block signingConfigs
# is evaluated before buildTypes, so the reference resolves correctly.
node -e "
const fs = require('fs');
const p = 'android/app/build.gradle';
let g = fs.readFileSync(p, 'utf8');
// 1. Insert signingConfigs block BEFORE buildTypes (so it is defined first)
const signingConfigs = ' signingConfigs {\n release {\n storeFile file(System.getenv(\"ANDROID_KEYSTORE_FILE\") ?: \"/dev/null\")\n storePassword System.getenv(\"ANDROID_KEYSTORE_PASSWORD\") ?: \"\"\n keyAlias System.getenv(\"ANDROID_KEY_ALIAS\") ?: \"\"\n keyPassword System.getenv(\"ANDROID_KEY_PASSWORD\") ?: \"\"\n }\n }\n\n';
g = g.replace(
/(\s*)(buildTypes\s*\{)/,
signingConfigs + '\$1\$2'
);
// 2. Add signingConfig reference inside release buildType
g = g.replace(
/(buildTypes\s*\{[\s\S]*?release\s*\{)/,
'\$1\n signingConfig signingConfigs.release'
);
g += \`
android {
signingConfigs {
release {
storeFile file(System.getenv(\"ANDROID_KEYSTORE_FILE\") ?: \"/dev/null\")
storePassword System.getenv(\"ANDROID_KEYSTORE_PASSWORD\") ?: \"\"
keyAlias System.getenv(\"ANDROID_KEY_ALIAS\") ?: \"\"
keyPassword System.getenv(\"ANDROID_KEY_PASSWORD\") ?: \"\"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
\`;
fs.writeFileSync(p, g);
console.log('Patched build.gradle with signing config');
"