-
Notifications
You must be signed in to change notification settings - Fork 305
Setup CI/CD to automatically compile and deploy builds to Internal Testing on Google Play #505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughA new GitHub Actions workflow is introduced to automate building and deploying the Android app to Google Play's internal testing track. Supporting changes include environment-variable-based configuration for deployment, updated documentation for configuration, version bumping, and expanded Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant GitHub Actions
participant Google Play Store
Developer->>GitHub Actions: Push to main/master/deploy-actions
GitHub Actions->>GitHub Actions: Checkout code, setup Java & Flutter
GitHub Actions->>GitHub Actions: Decode secrets (keystore, configs)
GitHub Actions->>GitHub Actions: Install dependencies & build AAB
GitHub Actions->>GitHub Actions: Upload AAB artifact
GitHub Actions->>Google Play Store: Deploy AAB to Internal Testing (using service account)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes detected. Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
🎉 Welcome @M4dhav!
We appreciate your contribution! 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR establishes a complete CI/CD pipeline for automated Android app deployment to Google Play Store's internal testing track. The changes enable environment-based configuration management and automatic build deployment on main branch pushes.
Key changes:
- Added GitHub Actions workflow for automated Android app bundle compilation and Google Play deployment
- Refactored hardcoded configuration values to use environment variables with fallback defaults
- Updated build number and documentation to reflect new deployment process
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/store_deploy_android.yml |
New CI/CD workflow for automated Android deployment to Google Play internal testing |
lib/utils/constants.dart |
Replaced hardcoded values with environment variables for flexible configuration |
pubspec.yaml |
Incremented build number from +2 to +3 |
android/.gitignore |
Added keys/ directory to ignore list for security |
ONBOARDING.md |
Updated documentation to reflect new environment variable usage |
Comments suppressed due to low confidence (1)
.github/workflows/store_deploy_android.yml:20
- Flutter version 3.32.5 does not exist. The latest stable Flutter version as of my knowledge cutoff is 3.24.x. Please verify and use a valid Flutter version.
FLUTTER_VERSION: 3.32.5
| steps: | ||
| # Checkout repository codebase | ||
| - name: Checkout the code | ||
| uses: actions/checkout@v3 |
Copilot
AI
Aug 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using actions/checkout@v3 is outdated. Consider upgrading to actions/checkout@v4 for better performance and security updates.
| uses: actions/checkout@v3 | |
| uses: actions/checkout@v4 |
|
|
||
| # Setup Java in the VM | ||
| - name: Setup Java to compile the Android project | ||
| uses: actions/setup-java@v2 |
Copilot
AI
Aug 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using actions/setup-java@v2 is deprecated. Consider upgrading to actions/setup-java@v4 for better performance and security updates.
| uses: actions/setup-java@v2 | |
| uses: actions/setup-java@v4 |
| # Upload generated aab to project artifacts | ||
| - name: Upload generated aab to the artifacts | ||
| uses: actions/upload-artifact@master |
Copilot
AI
Aug 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using actions/upload-artifact@master is not recommended as it references a moving target. Use a specific version tag like actions/upload-artifact@v4 for better stability and security.
| uses: actions/upload-artifact@master | |
| uses: actions/upload-artifact@v4 |
| branches: | ||
| - main | ||
| - master | ||
| - deploy-actions |
Copilot
AI
Aug 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'deploy-actions' branch appears to be a temporary development branch. Consider removing it from the production workflow triggers to avoid unintended deployments from feature branches.
| - deploy-actions |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
♻️ Duplicate comments (1)
.github/workflows/store_deploy_android.yml (1)
7-10: Temporary branch in production trigger
deploy-actionslooks like a feature branch; leaving it in the trigger risks unintentional store pushes.
🧹 Nitpick comments (4)
android/.gitignore (1)
17-17: Inconsistent ignore entry vs. workflow paths
keys/is now ignored, yet the workflow decodes the keystore toandroid/upload-keystore.jksandandroid/key.properties, not insidekeys/.
Unless another process places credentials underkeys/, this line is redundant noise in.gitignore.Remove the entry or point the workflow to
keys/for consistency.ONBOARDING.md (1)
106-107: Minor grammar & clarityConsider:
“… you can either update the default value of
baseDomaininconstants.dart, or pass it …”.github/workflows/store_deploy_android.yml (2)
64-66: Cache Pub packages to cut CI timeEach run downloads all dependencies. Add flutter-action’s cache or a manual
actions/cachestep.
30-97: YAML-lint: trailing spaces & missing EOF newlineClean up trailing whitespace (Lines 7, 14, 38, 55, 59) and add a newline at EOF to keep the linter green.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.github/workflows/store_deploy_android.yml(1 hunks)ONBOARDING.md(1 hunks)android/.gitignore(1 hunks)lib/utils/constants.dart(1 hunks)pubspec.yaml(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/store_deploy_android.yml
[error] 7-7: trailing spaces
(trailing-spaces)
[error] 14-14: trailing spaces
(trailing-spaces)
[error] 38-38: trailing spaces
(trailing-spaces)
[error] 55-55: trailing spaces
(trailing-spaces)
[error] 59-59: trailing spaces
(trailing-spaces)
[error] 97-97: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (1)
pubspec.yaml (1)
20-20: Version bump acknowledgedBuild number increment aligns with Play Store internal-testing requirements.
| # Setup env variables that will be used throughout the workflow | ||
| JAVA_VERSION: 17.0.12 | ||
| FLUTTER_VERSION: 3.32.5 | ||
| AAB_PATH: build/app/outputs/bundle/release/app-release.aab |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suspicious Flutter version
3.32.5 does not match any released Flutter SDK tag (current stable < 4.0). The action will fail when it tries to fetch this version.
- FLUTTER_VERSION: 3.32.5
+ # Pin to an existing stable tag (e.g. the version used by the repo)
+ FLUTTER_VERSION: 3.22.0Verify against flutter --version in the project.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Setup env variables that will be used throughout the workflow | |
| JAVA_VERSION: 17.0.12 | |
| FLUTTER_VERSION: 3.32.5 | |
| AAB_PATH: build/app/outputs/bundle/release/app-release.aab | |
| # Setup env variables that will be used throughout the workflow | |
| JAVA_VERSION: 17.0.12 | |
| # Pin to an existing stable tag (e.g. the version used by the repo) | |
| FLUTTER_VERSION: 3.22.0 | |
| AAB_PATH: build/app/outputs/bundle/release/app-release.aab |
🤖 Prompt for AI Agents
In .github/workflows/store_deploy_android.yml around lines 18 to 21, the Flutter
version is set to 3.32.5, which is not a valid released Flutter SDK version and
will cause the action to fail. Check the actual Flutter version used in the
project by running `flutter --version` locally, then update the FLUTTER_VERSION
variable to match the correct stable version tag.
| # Build Android Bundle release file | ||
| - name: Build aab | ||
| run: | | ||
| flutter build appbundle \ | ||
| --release \ | ||
| --dart-define=APPWRITE_BASE_DOMAIN=${{ secrets.APPWRITE_BASE_DOMAIN }} \ | ||
| --dart-define=APPWRITE_PROJECT_ID=${{ secrets.APPWRITE_PROJECT_ID }} | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Hard-fail build when secrets are absent
If a secret is undefined, flutter build will insert an empty string, producing the localhost fallback above. Add set -euo pipefail and explicit checks:
- run: |
+ run: |
[[ -n "${{ secrets.APPWRITE_BASE_DOMAIN }}" ]] || { echo "Missing APPWRITE_BASE_DOMAIN"; exit 1; }
[[ -n "${{ secrets.APPWRITE_PROJECT_ID }}" ]] || { echo "Missing APPWRITE_PROJECT_ID"; exit 1; }
flutter build appbundle \🤖 Prompt for AI Agents
In .github/workflows/store_deploy_android.yml around lines 75 to 82, the flutter
build command uses secrets that may be undefined, causing fallback to localhost.
To fix this, add `set -euo pipefail` at the start of the run script and insert
explicit checks for the presence of APPWRITE_BASE_DOMAIN and APPWRITE_PROJECT_ID
secrets before running flutter build. If any secret is missing, output an error
message and exit with failure to prevent proceeding with empty values.
| const String baseDomain = | ||
| String.fromEnvironment('APPWRITE_BASE_DOMAIN', defaultValue: 'localhost'); | ||
| const String appwriteProjectId = | ||
| String.fromEnvironment('APPWRITE_PROJECT_ID', defaultValue: 'resonate'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Environment-variable fallback may silently hit localhost in production
If APPWRITE_BASE_DOMAIN / APPWRITE_PROJECT_ID secrets are missing at build-time, the release build will connect to localhost / resonate, causing hard-to-debug prod outages.
-const String baseDomain =
- String.fromEnvironment('APPWRITE_BASE_DOMAIN', defaultValue: 'localhost');
+const String baseDomain = String.fromEnvironment('APPWRITE_BASE_DOMAIN');
-const String appwriteProjectId =
- String.fromEnvironment('APPWRITE_PROJECT_ID', defaultValue: 'resonate');
+const String appwriteProjectId = String.fromEnvironment('APPWRITE_PROJECT_ID');
+
+// Fail fast – throw if envs are absent in non-debug builds.
+void _ensureEnv() {
+ const bool _isDebug =
+ bool.fromEnvironment('dart.vm.product') == false; // true in debug/profile
+ if (!_isDebug && (baseDomain.isEmpty || appwriteProjectId.isEmpty)) {
+ throw StateError('Missing required compile-time env variables.');
+ }
+}
+// Call once on app start (e.g. in main()).📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const String baseDomain = | |
| String.fromEnvironment('APPWRITE_BASE_DOMAIN', defaultValue: 'localhost'); | |
| const String appwriteProjectId = | |
| String.fromEnvironment('APPWRITE_PROJECT_ID', defaultValue: 'resonate'); | |
| const String baseDomain = String.fromEnvironment('APPWRITE_BASE_DOMAIN'); | |
| const String appwriteProjectId = String.fromEnvironment('APPWRITE_PROJECT_ID'); | |
| // Fail fast – throw if envs are absent in non-debug builds. | |
| void _ensureEnv() { | |
| const bool _isDebug = | |
| bool.fromEnvironment('dart.vm.product') == false; // true in debug/profile | |
| if (!_isDebug && (baseDomain.isEmpty || appwriteProjectId.isEmpty)) { | |
| throw StateError('Missing required compile-time env variables.'); | |
| } | |
| } | |
| // Call once on app start (e.g. in main()). |
🤖 Prompt for AI Agents
In lib/utils/constants.dart around lines 4 to 7, the current environment
variable fallbacks default to 'localhost' and 'resonate', which can cause
production builds to silently connect to incorrect values if the variables are
missing. Remove or modify the defaultValue parameters so that missing
environment variables cause a clear failure or warning at build time, preventing
silent fallback to unsafe defaults in production.
|
✅ PR Closed - Thank You, @M4dhav!
We appreciate your effort and look forward to more contributions from you! 🤝 |
Description
This PR sets up a CI/CD Workflow to automatically compile and push app builds to the Google Play Store into internal testing. Additionally, it updates the Build Number in
pubspec.yamland makes changes to fetch sensitive information from Env Variables inconstants.dart. It also makes the necessary documentation updates.Fixes #504
Type of change
How Has This Been Tested?
Workflow runs were examined and verified to be functioning as expected.
Checklist:
Maintainer Checklist
Summary by CodeRabbit
New Features
Documentation
Refactor
Chores
.gitignoreto exclude thekeys/directory.