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 Java uses: actions/setup-java@v5 with: distribution: temurin java-version: '17' cache: gradle - name: Set up Flutter uses: subosito/flutter-action@v2 with: channel: stable cache: true - name: Cache Pub packages uses: actions/cache@v4 with: path: ~/.pub-cache key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} restore-keys: | ${{ runner.os }}-pub- - name: Flutter version run: flutter --version - name: Get dependencies run: flutter pub get - name: Analyze run: flutter analyze --no-fatal-infos - 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' || github.event_name == 'push' steps: - name: Checkout uses: actions/checkout@v6 - name: Set up Java uses: actions/setup-java@v5 with: distribution: temurin java-version: '17' cache: gradle - name: Set up Flutter uses: subosito/flutter-action@v2 with: channel: stable cache: true - name: Cache Pub packages uses: actions/cache@v4 with: path: ~/.pub-cache key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} restore-keys: | ${{ runner.os }}-pub- - 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 <