20226caef4
- Delete eas.json and strip extra.eas.projectId from app.json - Add plugins/withAndroidReleaseSigning.js — Expo config plugin that injects release signingConfig into the generated build.gradle during expo prebuild - Add build-apk.sh — self-contained build script (expo prebuild + Gradle) Reads keystore credentials from ~/.config/postiz-mobile/signing.env Outputs APK/AAB to dist/, wipes credentials from gradle.properties after build - Add install-android-sdk.sh — one-time Android SDK cmdline-tools bootstrap - Remove unused expo-task-manager dependency - Update .gitignore: android/, ios/, static-build/ excluded (generated) Build workflow: 1. eas credentials --platform android # export keystore once 2. ./install-android-sdk.sh # first time only 3. ./build-apk.sh # → dist/postiz-mobile-YYYYMMDD-HHMM.apk Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
const { withAppBuildGradle } = require("@expo/config-plugins");
|
|
|
|
// Injects a proper release signingConfig into the generated build.gradle.
|
|
// Reads credentials from gradle.properties (populated by build-apk.sh at build time).
|
|
// This plugin runs during `expo prebuild` so android/ doesn't need to be committed.
|
|
module.exports = function withAndroidReleaseSigning(config) {
|
|
return withAppBuildGradle(config, (mod) => {
|
|
let contents = mod.modResults.contents;
|
|
|
|
if (contents.includes("MYAPP_UPLOAD_STORE_FILE")) {
|
|
return mod; // already patched
|
|
}
|
|
|
|
const releaseBlock = ` release {
|
|
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
|
|
storeFile file(MYAPP_UPLOAD_STORE_FILE)
|
|
storePassword MYAPP_UPLOAD_STORE_PASSWORD
|
|
keyAlias MYAPP_UPLOAD_KEY_ALIAS
|
|
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
|
|
}
|
|
}`;
|
|
|
|
// Insert release signingConfig after the closing brace of the debug block
|
|
contents = contents.replace(
|
|
/(signingConfigs\s*\{[\s\S]*?debug\s*\{[\s\S]*?\})/,
|
|
`$1\n${releaseBlock}`
|
|
);
|
|
|
|
// Switch the release buildType from debug signing to release signing
|
|
contents = contents.replace(
|
|
/(buildTypes[\s\S]*?release\s*\{[\s\S]*?)signingConfig\s+signingConfigs\.debug/,
|
|
"$1signingConfig signingConfigs.release"
|
|
);
|
|
|
|
mod.modResults.contents = contents;
|
|
return mod;
|
|
});
|
|
};
|