@@ -122,14 +122,8 @@ jobs:
122122 # Building all ABIs together causes different AAPT2 resource compilation
123123 - name : Build APKs per-ABI (matching F-Droid)
124124 run : |
125- mkdir -p build/outputs/apk/release
126-
127- # Array of ABIs to build (matching F-Droid metadata order)
128- declare -A ABI_MAP=(
129- ["armeabi-v7a"]="armeabi-v7a"
130- ["arm64-v8a"]="arm64-v8a"
131- ["x86_64"]="x86_64"
132- )
125+ # Create final output directory (separate from build/outputs to survive clean)
126+ mkdir -p final_apks
133127
134128 for ABI in armeabi-v7a arm64-v8a x86_64; do
135129 echo "========================================="
@@ -151,12 +145,13 @@ jobs:
151145 # Clean and build this single ABI
152146 ./gradlew clean assembleRelease --stacktrace --no-build-cache
153147
154- # Find and rename the output APK
148+ # Find the output APK
155149 BUILT_APK=$(find build/outputs/apk/release -name "*.apk" -type f | head -1)
156150 if [ -n "$BUILT_APK" ]; then
157151 # Extract version from filename
158152 VERSION_NAME=$(echo "$BUILT_APK" | grep -oP 'v\d+\.\d+\.\d+' || echo "v${{ env.VERSION }}")
159153 FINAL_NAME="CleverKeys-${VERSION_NAME}-${ABI}.apk"
154+ FINAL_PATH="final_apks/$FINAL_NAME"
160155
161156 # Apply F-Droid postbuild steps to this APK
162157 echo "📦 Applying reproducibility fixes to $FINAL_NAME..."
@@ -168,12 +163,9 @@ jobs:
168163 python3 ${{ github.workspace }}/reproducible-apk-tools/inplace-fix.py \
169164 --page-size 16 --internal fix-pg-map-id "$BUILT_APK" 0000000
170165
171- # Rename if needed (Gradle may already use correct name)
172- FINAL_PATH="build/outputs/apk/release/$FINAL_NAME"
173- if [ "$BUILT_APK" != "$FINAL_PATH" ]; then
174- mv "$BUILT_APK" "$FINAL_PATH"
175- fi
176- echo "✅ Built: $FINAL_NAME"
166+ # Move to final directory (survives clean)
167+ mv "$BUILT_APK" "$FINAL_PATH"
168+ echo "✅ Built: $FINAL_NAME → saved to $FINAL_PATH"
177169 else
178170 echo "❌ ERROR: No APK found for $ABI"
179171 exit 1
@@ -185,6 +177,10 @@ jobs:
185177 # Restore original build.gradle
186178 git checkout build.gradle
187179
180+ # Copy all APKs to expected location for release step
181+ mkdir -p build/outputs/apk/release
182+ cp final_apks/*.apk build/outputs/apk/release/
183+
188184 echo "========================================="
189185 echo "📦 All APKs built:"
190186 ls -la build/outputs/apk/release/*.apk
0 commit comments