From 77a54401fc81c1aa9c36a9f10d49f2af0184e11d Mon Sep 17 00:00:00 2001 From: bponders12-cell Date: Mon, 31 Aug 2026 18:07:20 -0400 Subject: [PATCH] ci: add GitHub Actions Android build workflow --- .github/workflows/android-build.yml | 116 ++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 .github/workflows/android-build.yml diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml new file mode 100644 index 0000000..68247fe --- /dev/null +++ b/.github/workflows/android-build.yml @@ -0,0 +1,116 @@ +name: MotorSignal Android CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: android-build-${{ github.ref }} + cancel-in-progress: true + +jobs: + analyze-and-build: + name: Analyze and build Android + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + cache: true + + - name: Flutter version + run: flutter --version + + - name: Get dependencies + run: flutter pub get + + - name: Analyze + run: flutter analyze + + - name: Run tests + run: flutter test + + - name: Build debug APK + run: flutter build apk --debug + + - name: Upload debug APK + uses: actions/upload-artifact@v5 + with: + name: motorsignal-debug-apk + path: build/app/outputs/flutter-apk/app-debug.apk + if-no-files-found: error + retention-days: 14 + + release: + name: Build signed release APK + runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + cache: true + + - name: Get dependencies + run: flutter pub get + + - name: Restore release keystore + env: + KEYSTORE_BASE64: ${{ secrets.MOTORSIGNAL_KEYSTORE_BASE64 }} + run: | + test -n "$KEYSTORE_BASE64" || { echo "Missing MOTORSIGNAL_KEYSTORE_BASE64 repository secret"; exit 1; } + echo "$KEYSTORE_BASE64" | base64 --decode > android/app/motorsignal-upload-keystore.jks + + - name: Create signing properties + env: + STORE_PASSWORD: ${{ secrets.MOTORSIGNAL_STORE_PASSWORD }} + KEY_PASSWORD: ${{ secrets.MOTORSIGNAL_KEY_PASSWORD }} + KEY_ALIAS: ${{ secrets.MOTORSIGNAL_KEY_ALIAS }} + run: | + test -n "$STORE_PASSWORD" || { echo "Missing MOTORSIGNAL_STORE_PASSWORD repository secret"; exit 1; } + test -n "$KEY_PASSWORD" || { echo "Missing MOTORSIGNAL_KEY_PASSWORD repository secret"; exit 1; } + test -n "$KEY_ALIAS" || { echo "Missing MOTORSIGNAL_KEY_ALIAS repository secret"; exit 1; } + cat > android/key.properties <