-
-
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 all 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@v4 | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Setup Java in the VM | ||||||||||||||||||||
| - name: Setup Java to compile the Android project | ||||||||||||||||||||
| uses: actions/setup-java@v4 | ||||||||||||||||||||
| with: | ||||||||||||||||||||
| distribution: 'zulu' | ||||||||||||||||||||
| java-version: ${{ env.JAVA_VERSION }} | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Setup Flutter in the VM | ||||||||||||||||||||
| - name: Setup Flutter | ||||||||||||||||||||
| uses: subosito/flutter-action@v2 | ||||||||||||||||||||
| with: | ||||||||||||||||||||
| flutter-version: ${{ env.FLUTTER_VERSION }} | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Decode Android env variables | ||||||||||||||||||||
| - name: Decode Android keystore | ||||||||||||||||||||
| run: echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 --decode > ${{ env.KEYSTORE_PATH }} | ||||||||||||||||||||
|
|
||||||||||||||||||||
| - name: Decode Android key properties | ||||||||||||||||||||
| run: echo "${{ secrets.ANDROID_KEY_PROPERTIES }}" | base64 --decode > ${{ env.KEY_PROPS_PATH }} | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Decode Android release Service Account | ||||||||||||||||||||
| - name: Decode Android Service Account | ||||||||||||||||||||
| run: echo "${{ secrets.ANDROID_RELEASE_SERVICE_ACCOUNT }}" | base64 --decode > ${{ env.SERVICE_ACCOUNT_PATH }} | ||||||||||||||||||||
|
|
||||||||||||||||||||
| #Decode Google Services JSON for Android | ||||||||||||||||||||
| - name: Decode Android Google Services JSON | ||||||||||||||||||||
| run: echo "${{ secrets.GOOGLE_SERVICES_ANDROID }}" | base64 --decode > ${{ env.GOOGLE_SERVICES_ANDROID_PATH }} | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Decode Firebase Options Dart file | ||||||||||||||||||||
| - name: Decode Firebase Options | ||||||||||||||||||||
| run: echo "${{ secrets.FIREBASE_OPTIONS }}" | base64 --decode > ${{ env.FIREBASE_OPTIONS_PATH }} | ||||||||||||||||||||
|
|
||||||||||||||||||||
| - name: 📦 Install dependencies | ||||||||||||||||||||
| run: flutter pub get | ||||||||||||||||||||
|
|
||||||||||||||||||||
| #Enable after Decoupling is completed | ||||||||||||||||||||
| # - name: 🕵️ Analyze to check for bad Dart/Flutter practices | ||||||||||||||||||||
| # run: flutter analyze | ||||||||||||||||||||
|
|
||||||||||||||||||||
| #Enable after Tests are written | ||||||||||||||||||||
| # - name: 📉 Run all app tests | ||||||||||||||||||||
| # run: flutter test | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # 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 }} | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
Comment on lines
+75
to
+82
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. 🛠️ Refactor suggestion Hard-fail build when secrets are absent If a secret is undefined, - 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 |
||||||||||||||||||||
| # Upload generated aab to project artifacts | ||||||||||||||||||||
| - name: Upload generated aab to the artifacts | ||||||||||||||||||||
| uses: actions/upload-artifact@v4 | ||||||||||||||||||||
| with: | ||||||||||||||||||||
| name: aab-stores | ||||||||||||||||||||
| path: ${{ env.AAB_PATH }} | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Deploy bundle to Google Play internal testing | ||||||||||||||||||||
| - name: Deploy to Play Store (Internal testing) | ||||||||||||||||||||
| uses: r0adkll/upload-google-play@v1 | ||||||||||||||||||||
| with: | ||||||||||||||||||||
| serviceAccountJson: ${{ env.SERVICE_ACCOUNT_PATH }} | ||||||||||||||||||||
| packageName: com.resonate.resonate | ||||||||||||||||||||
| releaseFiles: ${{ env.AAB_PATH }} | ||||||||||||||||||||
| track: internal | ||||||||||||||||||||
| 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.