feat(wearos): add release signing via EAS credentials.json

This commit is contained in:
2026-08-24 10:50:12 +02:00
parent a94ebf3653
commit 630416ee3c
3 changed files with 38 additions and 0 deletions
+15
View File
@@ -30,6 +30,21 @@ cd "$WEAR_DIR"
echo "Building WearOS ($PROFILE) v$VERSION ($VERSION_CODE)..." echo "Building WearOS ($PROFILE) v$VERSION ($VERSION_CODE)..."
if [ "$PROFILE" = "release" ]; then if [ "$PROFILE" = "release" ]; then
if [ ! -f "$WEAR_DIR/../credentials.json" ]; then
echo "credentials.json not found. Downloading from EAS..."
cd "$PROJECT_ROOT"
eas credentials --platform android --non-interactive 2>/dev/null || {
echo "Auto-download failed. Run manually:"
echo " eas credentials --platform android"
echo " → Choose 'credentials.json: Upload/Download credentials'"
echo " → Choose 'Download credentials from EAS to credentials.json'"
echo " Then: cp credentials.json targets/wearos/credentials.json"
exit 1
}
cp credentials.json "$WEAR_DIR/credentials.json"
echo "credentials.json copied to targets/wearos/"
cd "$WEAR_DIR"
fi
./gradlew assembleRelease -PversionName="$VERSION" -PversionCode="$VERSION_CODE" ./gradlew assembleRelease -PversionName="$VERSION" -PversionCode="$VERSION_CODE"
APK_PATH="app/build/outputs/apk/release/app-release.apk" APK_PATH="app/build/outputs/apk/release/app-release.apk"
else else
+19
View File
@@ -5,6 +5,8 @@ plugins {
id("io.sentry.android.gradle") version "6.17.0" id("io.sentry.android.gradle") version "6.17.0"
} }
val credentialsFile = rootProject.file("../credentials.json")
android { android {
namespace = "nl.guidoit.swimbuddy" namespace = "nl.guidoit.swimbuddy"
compileSdk = 35 compileSdk = 35
@@ -22,6 +24,20 @@ android {
manifestPlaceholders["sentryDsn"] = sentryDsn manifestPlaceholders["sentryDsn"] = sentryDsn
} }
signingConfigs {
if (credentialsFile.exists()) {
create("release") {
val credentials = groovy.json.JsonSlurper().parse(credentialsFile) as Map<*, *>
val keystoreData = credentials["android"]!! as Map<*, *>
val keyData = keystoreData["keystore"]!! as Map<*, *>
storeFile = rootProject.file(keyData["keystorePath"] as String)
storePassword = keyData["keystorePassword"] as String
keyAlias = keyData["keyAlias"] as String
keyPassword = keyData["keyPassword"] as? String ?: keyData["keystorePassword"] as String
}
}
}
buildTypes { buildTypes {
release { release {
isMinifyEnabled = true isMinifyEnabled = true
@@ -30,6 +46,9 @@ android {
getDefaultProguardFile("proguard-android-optimize.txt"), getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro" "proguard-rules.pro"
) )
if (credentialsFile.exists()) {
signingConfig = signingConfigs.getByName("release")
}
} }
} }
@@ -34,6 +34,10 @@
android:name="io.sentry.attach-screenshot" android:name="io.sentry.attach-screenshot"
android:value="true" /> android:value="true" />
<meta-data
android:name="com.google.android.wearable.standalone"
android:value="false" />
<activity <activity
android:name=".SwimBuddyWearActivity" android:name=".SwimBuddyWearActivity"
android:exported="true" android:exported="true"