Skip to content

Commit 8d34b2d

Browse files
committed
part 8 --no-bump
1 parent 77206f8 commit 8d34b2d

1 file changed

Lines changed: 37 additions & 6 deletions

File tree

.github/workflows/debugbuild.yml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ jobs:
6969
- name: Install basic dependencies in container
7070
run: |
7171
apt-get update
72-
apt-get install -y curl git unzip xz-utils zip libglu1-mesa file jq cmake ninja-build pkg-config clang lld
72+
apt-get install -y curl git unzip xz-utils zip libglu1-mesa file jq cmake ninja-build pkg-config clang-14 lld-14
73+
# Create symlinks so Flutter finds the linker
74+
ln -sf /usr/bin/ld.lld-14 /usr/bin/ld.lld
75+
ln -sf /usr/bin/lld-14 /usr/bin/lld
7376
7477
- name: Checkout repository
7578
uses: actions/checkout@v4
@@ -231,11 +234,39 @@ jobs:
231234

232235
- name: Build signed Android APK
233236
run: |
234-
flutter build apk --release -v --flavor ${{ github.ref_name }} --dart-define FLUTTER_FLAVOR=${{ github.ref_name }}
235-
echo "Built APKs:"
236-
ls -la build/app/outputs/flutter-apk/
237-
echo "All APK files in build:"
238-
find build -name "*.apk" -type f
237+
set -e
238+
BRANCH="${{ github.ref_name }}"
239+
echo "Building Android APK for flavor: $BRANCH"
240+
241+
if flutter build apk --release -v --flavor "$BRANCH" --dart-define FLUTTER_FLAVOR=${{ github.ref_name }}; then
242+
echo "flutter build apk succeeded"
243+
else
244+
echo "flutter build apk failed — attempting Gradle fallback to locate APKs"
245+
cd android
246+
# Capitalize first letter for Gradle variant name (e.g. nightly -> Nightly)
247+
VAR_CAP="$(tr '[:lower:]' '[:upper:]' <<< "${BRANCH:0:1}")${BRANCH:1}"
248+
echo "Attempting assemble${VAR_CAP}Release"
249+
./gradlew --no-daemon assemble${VAR_CAP}Release || true
250+
cd ..
251+
252+
# Try to find any APK produced by Gradle and copy into flutter-apk output dir
253+
FOUND_APK=$(find . -path "*/build/*" -type f -name "*-${BRANCH}-release.apk" -o -name "*-${VAR_CAP}Release.apk" -o -name "app-release.apk" | head -n 1 || true)
254+
if [ -n "$FOUND_APK" ]; then
255+
echo "Found APK: $FOUND_APK"
256+
mkdir -p build/app/outputs/flutter-apk
257+
cp "$FOUND_APK" "build/app/outputs/flutter-apk/app-${BRANCH}-release.apk"
258+
echo "Copied APK to build/app/outputs/flutter-apk/app-${BRANCH}-release.apk"
259+
else
260+
echo "No APK found after Gradle fallback"
261+
find . -path "*/build/*" -type f -name "*.apk" || true
262+
exit 1
263+
fi
264+
fi
265+
266+
echo "Built APKs in flutter-apk dir:"
267+
ls -la build/app/outputs/flutter-apk/ || true
268+
echo "All APK files in build tree:"
269+
find . -path "*/build/*" -type f -name "*.apk" || true
239270
240271
- name: Get version from pubspec.yaml
241272
id: get_version

0 commit comments

Comments
 (0)