diff --git a/.github/workflows/apk.yml b/.github/workflows/apk.yml new file mode 100644 index 0000000..661e537 --- /dev/null +++ b/.github/workflows/apk.yml @@ -0,0 +1,56 @@ +name: Build test APK + +# Manually-triggered build of the example app APK, uploaded as a downloadable +# artifact. Use this to get a test build without cutting a public release. +on: + workflow_dispatch: + +permissions: + contents: read + +jobs: + build-apk: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Set up Java 17 + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: '17' + + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: '3.32.5' + channel: 'stable' + cache: true + + - name: Read version + id: ver + run: echo "VERSION=$(grep '^version:' pubspec.yaml | cut -d ' ' -f 2 | cut -d '+' -f 1)" >> "$GITHUB_OUTPUT" + + - name: Install example dependencies + run: flutter pub get + working-directory: example + + - name: Build release APK + run: flutter build apk --release + working-directory: example + timeout-minutes: 20 + + - name: Rename APK with version + run: | + cd example/build/app/outputs/flutter-apk/ + mv app-release.apk document_scanner_example_v${{ steps.ver.outputs.VERSION }}.apk + ls -la *.apk + + - name: Upload APK artifact + uses: actions/upload-artifact@v4 + with: + name: document_scanner_example_v${{ steps.ver.outputs.VERSION }}-apk + path: example/build/app/outputs/flutter-apk/document_scanner_example_v${{ steps.ver.outputs.VERSION }}.apk + if-no-files-found: error + retention-days: 30