This commit is contained in:
@@ -108,6 +108,39 @@ jobs:
|
||||
run: |
|
||||
npx cap add android
|
||||
echo "sdk.dir=${ANDROID_SDK_ROOT}" > android/local.properties
|
||||
|
||||
# Inject signing config into the generated build.gradle
|
||||
node -e "
|
||||
const fs = require('fs');
|
||||
const p = 'android/app/build.gradle';
|
||||
let g = fs.readFileSync(p, 'utf8');
|
||||
|
||||
const signingBlock = \`
|
||||
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') ?: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
\`;
|
||||
|
||||
// Append a separate android block with signingConfigs (Gradle merges them)
|
||||
g += signingBlock;
|
||||
|
||||
// Add signingConfig to the release buildType
|
||||
g = g.replace(
|
||||
/(buildTypes\\s*\\{[\\s\\S]*?release\\s*\\{)/,
|
||||
'\$1\\n signingConfig signingConfigs.release'
|
||||
);
|
||||
|
||||
fs.writeFileSync(p, g);
|
||||
console.log('Patched build.gradle with signing config');
|
||||
"
|
||||
|
||||
npx cap sync android
|
||||
working-directory: apps/android
|
||||
|
||||
@@ -120,8 +153,17 @@ jobs:
|
||||
- name: Copy APK to dist
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
cp apps/android/android/app/build/outputs/apk/release/app-release.apk \
|
||||
apps/electron/dist/DiscordClone-v${VERSION}.apk
|
||||
APK_DIR="apps/android/android/app/build/outputs/apk/release"
|
||||
if [ -f "$APK_DIR/app-release.apk" ]; then
|
||||
cp "$APK_DIR/app-release.apk" "apps/electron/dist/DiscordClone-v${VERSION}.apk"
|
||||
elif [ -f "$APK_DIR/app-release-unsigned.apk" ]; then
|
||||
echo "Warning: APK is unsigned (signing secrets may be missing)"
|
||||
cp "$APK_DIR/app-release-unsigned.apk" "apps/electron/dist/DiscordClone-v${VERSION}.apk"
|
||||
else
|
||||
echo "Error: No APK found in $APK_DIR"
|
||||
ls -la "$APK_DIR/" 2>/dev/null || echo "Directory does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: List build artifacts
|
||||
run: ls -la apps/electron/dist/
|
||||
|
||||
1704
logs/log1.txt
Normal file
1704
logs/log1.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user