Skip to content

Commit 370aa7e

Browse files
committed
feat: preview auto sign
1 parent 1dce7dc commit 370aa7e

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

.github/workflows/preview.yml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,34 @@ jobs:
6060
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
6161
./run init action gradle
6262
./gradlew app:assemblePreviewRelease
63+
64+
# Sign unsigned APKs with default debug keystore
65+
if [ ! -f ~/.android/debug.keystore ]; then
66+
echo "Generating debug.keystore..."
67+
mkdir -p ~/.android
68+
keytool -genkey -v -keystore ~/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Android Debug,O=Android,C=US"
69+
fi
70+
71+
APKSIGNER=$(find ${ANDROID_HOME}/build-tools -name apksigner | sort -V | tail -n 1)
72+
if [ -z "$APKSIGNER" ]; then
73+
APKSIGNER="apksigner"
74+
fi
75+
echo "Using apksigner: $APKSIGNER"
76+
6377
APK=$(find app/build/outputs/apk -name '*arm64-v8a*.apk')
64-
APK=$(dirname $APK)
65-
echo "APK=$APK" >> $GITHUB_ENV
78+
APK_DIR=$(dirname $APK)
79+
80+
echo "Signing APKs in $APK_DIR..."
81+
for apk in "$APK_DIR"/*-unsigned.apk; do
82+
if [ -f "$apk" ]; then
83+
signed_apk="${apk%-unsigned.apk}-debug-signed.apk"
84+
echo "Signing $apk -> $signed_apk"
85+
$APKSIGNER sign --ks ~/.android/debug.keystore --ks-pass pass:android --key-pass pass:android --out "$signed_apk" "$apk"
86+
rm "$apk"
87+
fi
88+
done
89+
90+
echo "APK=$APK_DIR" >> $GITHUB_ENV
6691
- uses: actions/upload-artifact@v5
6792
with:
6893
name: APKs

nb4a.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
PACKAGE_NAME=com.nb4a
22
VERSION_NAME=1.4.2-mod-19
3-
PRE_VERSION_NAME=pre-1.4.2-20260214-1
3+
PRE_VERSION_NAME=pre-1.4.2-20260714-1
44
VERSION_CODE=46

0 commit comments

Comments
 (0)