-
Notifications
You must be signed in to change notification settings - Fork 356
fix(ci) : Build and deploy workflow #581
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
093f778
fix(deps): Added automatic Google play deployment'
uju09 a5c5f95
fix: Updated build
uju09 8a1d0f8
fix: Added cache and an debug step
uju09 a38745e
fixed a small bug
uju09 7285482
fix(tests): changed from aab to apk
uju09 15701fb
updated the changes
uju09 d7b1350
added the missing lines
uju09 4947dd5
updated requested changes
uju09 6a2064b
removed master and added workflow-dispatch
uju09 cee89b6
updated
uju09 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,82 +1,113 @@ | ||
| name: Build and Deploy | ||
| # 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 | ||
| pull_request: | ||
| types: [closed] | ||
| branches: | ||
| - master | ||
| workflow_dispatch: | ||
|
Contributor
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. Keep workflow_dispatch so that we can trigger the workflow manually |
||
| - deploy-actions | ||
|
|
||
| jobs: | ||
| build: | ||
| store_deploy_android: | ||
| name: android store release | ||
| runs-on: ubuntu-latest | ||
|
|
||
| env: | ||
| # Setup env variables that will be used throughout the workflow | ||
| # Changed to Java 17 for better Gradle compatibility | ||
| JAVA_VERSION: 17 | ||
uju09 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| FLUTTER_VERSION: 3.35.2 | ||
| AAB_PATH: build/app/outputs/bundle/release/app-release.aab | ||
| KEYSTORE_PATH: android/upload-keystore.jks | ||
| KEY_PROPS_PATH: android/key.properties | ||
| # Added paths for Play Store and Firebase secrets | ||
| SERVICE_ACCOUNT_PATH: store_credentials.json | ||
| FIREBASE_OPTIONS_PATH: lib/firebase_options.dart | ||
| GOOGLE_SERVICES_ANDROID_PATH: android/app/google-services.json | ||
| APPWRITE_PROJECT_ID: ${{ secrets.APPWRITE_PROJECT_ID }} | ||
| steps: | ||
| # 1. Remove Cached Flutter Installation | ||
| - name: Remove Cached Flutter Installation | ||
| run: rm -rf $HOME/.flutter | ||
| # Checkout repository codebase | ||
| - name: Checkout the code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Clean up old build files | ||
| run: | | ||
| rm -rf build/app/outputs/bundle/release/* | ||
| # 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 }} | ||
|
|
||
| # 2. Checkout repository | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Android SDK | ||
| uses: android-actions/setup-android@v3 | ||
|
|
||
| # 3. Install Flutter SDK | ||
| - name: Install Flutter | ||
| # Setup Flutter in the VM | ||
| - name: Setup Flutter | ||
| uses: subosito/flutter-action@v2 | ||
| with: | ||
| flutter-version: 3.35.2 | ||
| flutter-version: ${{ env.FLUTTER_VERSION }} | ||
| cache: true # Added caching to speed up builds | ||
|
|
||
| # 4. Verify Flutter and Dart Versions | ||
| - name: Verify Flutter Installation | ||
| run: | | ||
| flutter --version | ||
| dart --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 }} | ||
|
|
||
| # --- Steps Added to fix deployment --- | ||
| # Decode Android release Service Account | ||
| - name: Decode Android Service Account | ||
| run: echo "${{ secrets.ANDROID_RELEASE_SERVICE_ACCOUNT }}" | base64 --decode > ${{ env.SERVICE_ACCOUNT_PATH }} | ||
|
|
||
| # 6. Install Flutter dependencies | ||
| - name: Install Flutter Dependencies | ||
| #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 }} | ||
| # --- End of Added Steps --- | ||
|
|
||
| - name: 📦 Install dependencies | ||
| run: flutter pub get | ||
|
|
||
| # 7. Build Android APK | ||
| - name: Build Android App Bundle | ||
| run: flutter build apk --release --split-per-abi | ||
| - name: 📉 Run all app tests | ||
| run: flutter test | ||
|
|
||
| # 8. Upload build artifacts | ||
| - name: Upload APK as an artifact | ||
| # 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 }} | ||
|
|
||
| # Upload generated aab to project artifacts | ||
| - name: Upload generated AAB to artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: app-release-apks | ||
| path: build/app/outputs/apk/release/*.apk | ||
|
|
||
| release: | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| # 1. Checkout repository | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| name: aab-stores | ||
| path: ${{ env.AAB_PATH }} | ||
|
|
||
| # 2. Download build artifacts | ||
| - name: Download APK | ||
| uses: actions/download-artifact@v4 | ||
| # --- Deploy to Google Play Store --- | ||
| - name: Deploy to Play Store (Internal testing) | ||
| uses: r0adkll/upload-google-play@v1 | ||
| with: | ||
| name: app-release-apks | ||
| path: build/app/outputs/bundle/release/ | ||
|
|
||
| # 3. Upload to Github Release | ||
| - name: Github Release | ||
| serviceAccountJson: ${{ env.SERVICE_ACCOUNT_PATH }} | ||
| packageName: com.resonate.resonate # Using the package name from your other workflow | ||
| releaseFiles: ${{ env.AAB_PATH }} | ||
| track: internal | ||
|
|
||
| # --- Added GitHub Release Step --- | ||
| - name: Deploy to GitHub Release | ||
| uses: ncipollo/[email protected] | ||
| with: | ||
| allowUpdates: true | ||
| artifacts: build/app/outputs/bundle/release/*.apk | ||
| artifactContentType: apk | ||
| # This will find the .aab file in the release directory | ||
| artifacts: ${{ env.AAB_PATH }} | ||
| artifactContentType: aab | ||
| generateReleaseNotes: true | ||
| tag: latest_build | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
uju09 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Resonate has a
masterbranch, notmain