From c31080926f95f963337219bbca9f6e2df15d154d Mon Sep 17 00:00:00 2001 From: Sanketh B K <51091231+SankethBK@users.noreply.github.com> Date: Sun, 13 Oct 2024 13:54:23 +0530 Subject: [PATCH] Add workflow to build and attach APK to release (#248) --- .github/workflows/build_apk.yml | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/build_apk.yml diff --git a/.github/workflows/build_apk.yml b/.github/workflows/build_apk.yml new file mode 100644 index 00000000..25e981a7 --- /dev/null +++ b/.github/workflows/build_apk.yml @@ -0,0 +1,51 @@ +name: Build and Attach APKs on Release + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + # Step 1: Check out the repository at the release's tag + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Fetch all history to get the release tag + ref: ${{ github.event.release.tag_name }} + + # Step 2: Set up Flutter 3.13.0 + - name: Install Flutter 3.13.0 + uses: subosito/flutter-action@v2 + with: + flutter-version: '3.13.0' + + # Step 3: Build the APKs + - name: Build APKs + run: flutter build apk --split-per-abi + + # Step 4: Upload the APKs as release assets + - name: Upload APKs + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: build/app/outputs/flutter-apk/app-arm64-v8a-release.apk + asset_name: app-arm64-v8a-release.apk + asset_content_type: application/vnd.android.package-archive + + - name: Upload APK (armeabi-v7a) + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk + asset_name: app-armeabi-v7a-release.apk + asset_content_type: application/vnd.android.package-archive + + - name: Upload APK (x86_64) + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: build/app/outputs/flutter-apk/app-x86_64-release.apk + asset_name: app-x86_64-release.apk + asset_content_type: application/vnd.android.package-archive