Skip to content

Commit

Permalink
Create flutter-build-apk.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Shashwat12-egov authored Nov 21, 2024
1 parent 4400791 commit 208676f
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/flutter-build-apk.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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

0 comments on commit 208676f

Please sign in to comment.