Update generate-apk.sh #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |