From 208676f158e5db03c9625d31581c94d257d5363c Mon Sep 17 00:00:00 2001 From: Shashwat12-egov Date: Thu, 21 Nov 2024 12:50:14 +0530 Subject: [PATCH] Create flutter-build-apk.yml --- .github/workflows/flutter-build-apk.yml | 62 +++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/flutter-build-apk.yml diff --git a/.github/workflows/flutter-build-apk.yml b/.github/workflows/flutter-build-apk.yml new file mode 100644 index 000000000..ac3cd3e0b --- /dev/null +++ b/.github/workflows/flutter-build-apk.yml @@ -0,0 +1,62 @@ +name: Build APK Workflow + +on: + push: + branches: ['develop', 'starter-pack'] # This specifies that the workflow will run on any push to the 'main' branch + pull_request: + branches: ['develop', 'starter-pack'] # Optionally, run on pull requests targeting the 'main' branch + +jobs: + build-apk: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' # Specify the Java distribution + + - name: Flutter action + uses: subosito/flutter-action@v2.8.0 + with: + flutter-version: "3.16.5" + + - name: Set up Android SDK + uses: android-actions/setup-android@v2 + with: + api-level: 30 + build-tools: 30.0.3 + + - name: Install Dependencies + run: flutter pub get + + - name: Create .env file + run: | + echo "BASE_URL=${{ vars.BASE_URL }}" >> apps/health_campaign_field_worker_app/.env + echo "MDMS_API_PATH=${{ vars.MDMS_API_PATH }}" >> apps/health_campaign_field_worker_app/.env + echo "TENANT_ID=${{ vars.TENANT_ID }}" >> apps/health_campaign_field_worker_app/.env + echo "ACTIONS_API_PATH=${{ vars.ACTIONS_API_PATH }}" >> apps/health_campaign_field_worker_app/.env + echo "SYNC_DOWN_RETRY_COUNT=${{ vars.SYNC_DOWN_RETRY_COUNT }}" >> apps/health_campaign_field_worker_app/.env + echo "RETRY_TIME_INTERVAL=${{ vars.RETRY_TIME_INTERVAL }}" >> apps/health_campaign_field_worker_app/.env + echo "CONNECT_TIMEOUT=${{ vars.CONNECT_TIMEOUT }}" >> apps/health_campaign_field_worker_app/.env + echo "RECEIVE_TIMEOUT=${{ vars.RECEIVE_TIMEOUT }}" >> apps/health_campaign_field_worker_app/.env + echo "SEND_TIMEOUT=${{ vars.SEND_TIMEOUT }}" >> apps/health_campaign_field_worker_app/.env + echo "CHECK_BANDWIDTH_API=${{ vars.CHECK_BANDWIDTH_API }}" >> apps/health_campaign_field_worker_app/.env + echo "HIERARCHY_TYPE=${{ vars.HIERARCHY_TYPE }}" >> apps/health_campaign_field_worker_app/.env + echo "ENV_NAME=${{ vars.ENV_NAME }}" >> apps/health_campaign_field_worker_app/.env + + - name: Run APK build script + env: + BUILD_CONFIG: release # or profile depending on your choice + run: bash ./tools/generate-apk.sh + + # Archive the APK as a build artifact so it can be downloaded + - name: Upload APKs + uses: actions/upload-artifact@v3 + with: + name: app-release-apk + path: apps/health_campaign_field_worker_app/build/app/outputs/flutter-apk/app-release.apk