-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
Changes from 5 commits
2dab644
882b8dc
ad51d1f
0662f5a
6f97a60
37d5f53
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,97 @@ | ||||||||||||||||||||
| ## Github Actions CI workflow to deploy to Internal testing in the Play Store | ||||||||||||||||||||
| name: CI_STORE_DEPLOY_ANDROID | ||||||||||||||||||||
|
|
||||||||||||||||||||
| on: | ||||||||||||||||||||
| # Run this workflow when any new code is pushed into the main branch | ||||||||||||||||||||
| push: | ||||||||||||||||||||
| branches: | ||||||||||||||||||||
| - main | ||||||||||||||||||||
| - master | ||||||||||||||||||||
| - deploy-actions | ||||||||||||||||||||
|
|
||||||||||||||||||||
| jobs: | ||||||||||||||||||||
| store_deploy_android: | ||||||||||||||||||||
|
|
||||||||||||||||||||
| name: android store release | ||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||
| env: | ||||||||||||||||||||
| # 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 | ||||||||||||||||||||
|
Comment on lines
+18
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suspicious Flutter 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 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| KEYSTORE_PATH: android/upload-keystore.jks | ||||||||||||||||||||
| KEY_PROPS_PATH: android/key.properties | ||||||||||||||||||||
| SERVICE_ACCOUNT_PATH: store_credentials.json | ||||||||||||||||||||
| FIREBASE_OPTIONS_PATH: lib/firebase_options.dart | ||||||||||||||||||||
| GOOGLE_SERVICES_ANDROID_PATH: android/app/google-services.json | ||||||||||||||||||||
| steps: | ||||||||||||||||||||
| # Checkout repository codebase | ||||||||||||||||||||
| - name: Checkout the code | ||||||||||||||||||||
| uses: actions/checkout@v3 | ||||||||||||||||||||
|
||||||||||||||||||||
| uses: actions/checkout@v3 | |
| uses: actions/checkout@v4 |
Outdated
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 |
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.
Outdated
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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,3 +14,4 @@ key.properties | |
| app/google-services.json | ||
|
|
||
| /app/.cxx/ | ||
| keys/ | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,9 +1,10 @@ | ||||||||||||||||||||||||||||||||||
| // This file contains constants that are used throughout the app. | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // Appwrite Project Constants | ||||||||||||||||||||||||||||||||||
| const String baseDomain = "192.168.29.24"; | ||||||||||||||||||||||||||||||||||
| //const String baseDomain = "10.0.2.2"; | ||||||||||||||||||||||||||||||||||
| const String appwriteProjectId = "resonate"; | ||||||||||||||||||||||||||||||||||
| const String baseDomain = | ||||||||||||||||||||||||||||||||||
| String.fromEnvironment('APPWRITE_BASE_DOMAIN', defaultValue: 'localhost'); | ||||||||||||||||||||||||||||||||||
| const String appwriteProjectId = | ||||||||||||||||||||||||||||||||||
| String.fromEnvironment('APPWRITE_PROJECT_ID', defaultValue: 'resonate'); | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+4
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Environment-variable fallback may silently hit localhost in production If -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
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| const String appwriteEndpoint = "http://$baseDomain:80/v1"; | ||||||||||||||||||||||||||||||||||
| const String localhostLivekitEndpoint = "http://$baseDomain:7880"; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
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.