Skip to content

Conversation

uju09
Copy link
Contributor

@uju09 uju09 commented Oct 7, 2025

Description

This PR fixes the broken Build and Deploy workflow that was caused by recent Play Store compatibility changes and versioning updates. The workflow now properly handles automatic deployment, signing configuration, and artifact management.

Key Changes:

  • Modified workflow triggers to only run on push to master branch (removed PR triggers as requested)
  • Added workflow_dispatch for manual triggering capability
  • Fixed Flutter APK artifact paths from incorrect locations to correct build/app/outputs/flutter-apk/ directory
  • Corrected duplicate signing configuration in android/app/build.gradle.kts
  • Added proper secret decoding for keystore, Firebase configs, and Google Services
  • Implemented unique release versioning using github.run_number instead of static tags
  • Added automated testing step before builds in both workflows

Fixes #539

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • Documentation update

How Has This Been Tested?

Local Testing:

  • Ran flutter test - all tests passing
  • Reviewed workflow syntax for correctness

Workflow Testing:

  • Will test on feature branch after PR creation (workflows won't run on PR as designed)
  • After merge to master, both workflows will automatically trigger and validate:
    • Build and Deploy workflow (APK build + GitHub release)
    • Store Deploy Android workflow (AAB build + Play Store deployment)

Test Configuration:

  • Flutter Version: 3.35.2
  • Java Version: 21.0.6
  • Android compileSdk: 36
  • Workflow Runner: ubuntu-latest

Files Changed

  1. .github/workflows/build_and_deploy.yml - Complete workflow rewrite with proper configuration
  2. .github/workflows/store_deploy_android.yml - Updated trigger configuration
  3. android/app/build.gradle.kts - Fixed duplicate signing config issue

Breaking Changes

None. This PR maintains backward compatibility while fixing broken functionality:

  • Workflows still trigger on push to master (existing behavior)
  • Manual triggering via workflow_dispatch is preserved
  • Only removed automatic PR triggers which were causing unwanted workflow runs

Description

This PR fixes the broken Build and Deploy workflows by updating trigger configuration and correcting Android build signing setup. The changes address workflow failures caused by Play Store compatibility requirements and ensure proper artifact management.

Fixes #(issue)

Changes Made

1. .github/workflows/build_and_deploy.yml

What changed:

  • Modified trigger from push + pull_request + workflow_dispatch to push (master only) + workflow_dispatch
  • Added Java 21 and Android SDK setup steps
  • Added secret decoding for keystore, Firebase configs, and Google Services
  • Fixed APK artifact path from build/app/outputs/apk/release/ to build/app/outputs/flutter-apk/
  • Added flutter test step before builds
  • Changed release tag from static latest_build to dynamic v1.0.${{ github.run_number }}
  • Added dart-define parameters for Appwrite configuration

Why:

  • Prevents unwanted workflow runs on PRs
  • Ensures proper app signing with release keystore
  • Fixes artifact upload/download failures
  • Maintains unique release version history

2. .github/workflows/store_deploy_android.yml

What changed:

  • Modified trigger from push (main/master/deploy-actions) + pull_request + workflow_dispatch to push (master only) + workflow_dispatch

Why:

  • Aligns with consistent trigger policy across workflows
  • Prevents duplicate/unwanted Play Store deployments on PRs
  • Maintains manual deployment capability for emergency releases

3. android/app/build.gradle.kts

What changed:

  • Removed duplicate signingConfig = signingConfigs.getByName("debug") line
  • Moved signingConfigs block outside of buildTypes for proper Kotlin DSL structure
  • Kept only signingConfig = signingConfigs.getByName("release") in release build type

Why:

  • Fixes build signing to use release keystore instead of debug
  • Corrects Kotlin DSL configuration structure
  • Ensures APKs/AABs are properly signed for Play Store submission

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Testing

Local Verification:

  • Reviewed workflow YAML syntax
  • Verified build.gradle.kts Kotlin syntax
  • Confirmed GitHub Secrets are configured
  • After merge, will monitor workflow execution on master

Expected Behavior After Merge:

  • Build and Deploy workflow creates signed APKs and GitHub releases
  • Store Deploy workflow creates AAB and deploys to Play Store internal track
  • Both workflows only trigger on push to master or manual dispatch

Files Changed

File Lines Changed Purpose
.github/workflows/build_and_deploy.yml Complete rewrite Fix triggers, signing, artifacts
.github/workflows/store_deploy_android.yml Trigger section Align trigger policy
android/app/build.gradle.kts Signing config Remove duplicate, fix structure

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Additional Notes

Required for Deployment:
Ensure all GitHub Secrets are configured before merge:

  • ANDROID_KEYSTORE
  • ANDROID_KEY_PROPERTIES
  • ANDROID_RELEASE_SERVICE_ACCOUNT
  • GOOGLE_SERVICES_ANDROID
  • FIREBASE_OPTIONS
  • APPWRITE_BASE_DOMAIN
  • APPWRITE_PROJECT_ID

Post-Merge Validation:
After merging to master, monitor the Actions tab to ensure both workflows complete successfully.

Maintainer Checklist

  • closes Fix Build and Deploy workflow #539
  • bug, ci, workflows
  • Verify all GitHub Secrets are configured before merge
  • Monitor first workflow run after merge for successful completion

uju09 added 2 commits October 6, 2025 18:14
Signed-off-by: Ujwal Akotkar <24bcs012@iiitdwd.ac.in>
…y Store deployment

Signed-off-by: Ujwal Akotkar <24bcs012@iiitdwd.ac.in>
Copy link
Contributor

github-actions bot commented Oct 7, 2025

🎉 Welcome @uju09!
Thank you for your pull request! Our team will review it soon. 🔍

  • Please ensure your PR follows the contribution guidelines. ✅
  • All automated tests should pass before merging. 🔄
  • If this PR fixes an issue, link it in the description. 🔗

We appreciate your contribution! 🚀

Copy link

coderabbitai bot commented Oct 7, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@uju09
Copy link
Contributor Author

uju09 commented Oct 7, 2025

@M4dhav I request you to review it.

@uju09 uju09 changed the title feat(ci)/fix build deploy workflow feat(ci):fix build deploy workflow Oct 7, 2025
@M4dhav M4dhav self-requested a review October 13, 2025 17:43
@M4dhav M4dhav added the bug Something isn't working label Oct 13, 2025
@M4dhav M4dhav linked an issue Oct 13, 2025 that may be closed by this pull request
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are not related to the PR, please revert

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are not related to the PR, please revert

run: |
flutter build apk \
--release \
--split-per-abi \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is splitting the builds a good idea? This will form different apks for different architectures but most people do not know their architecture. What do you think we should do?

Splitting would mean smaller apks but arguably UX will be a little worse.

@uju09
Copy link
Contributor Author

uju09 commented Oct 13, 2025

@M4dhav I will resolve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Build and Deploy workflow

2 participants