-
Notifications
You must be signed in to change notification settings - Fork 292
# Fix: Build and Deploy Workflow (#539) #658
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
base: master
Are you sure you want to change the base?
# Fix: Build and Deploy Workflow (#539) #658
Conversation
WalkthroughThis PR updates three GitHub Actions workflows to standardize environment versions (Java to "21", Flutter to "3.27.2"), enable build caching, generate Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
|
🎉 Welcome @dimension-drifter!
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.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
.github/workflows/build_and_deploy.yml (1)
14-48: Flutter 3.27.2 is outdated and has documented build issues—verify version choice intentionality.
Flutter 3.27.2 is not the current latest stable as of December 2025 (Flutter 3.38.1 is current, documented as of Nov 12, 2025). Version 3.27.2 has known issues around impeller and emulator/Windows/iOS builds. The project lacks explicit version pinning (no.fvmrcfile and pubspec.yaml does not constrain Flutter version), so the workflow's hardcodedFLUTTER_VERSION: "3.27.2"is the only version specification. Confirm whether this pinning is intentional (e.g., for compatibility) or should be updated to a current stable release.The local
local.propertiesgeneration logic is correct and aligns with Gradle expectations..github/workflows/run_tests.yml (1)
18-45: Createandroid/directory defensively before writinglocal.properties.The
android/directory may not exist when the script runs, causing the echo commands to fail. Addmkdir -p androidat the start of the script to ensure it exists.Note:
ANDROID_SDK_ROOTis provided by default on ubuntu-latest runners, andFLUTTER_ROOTis set by subosito/flutter-action@v2, so both environment variables will be available. The suggested parameter expansion checks and fallback logic are not necessary.- name: Create local.properties run: | + mkdir -p android echo "sdk.dir=$ANDROID_SDK_ROOT" > android/local.properties echo "flutter.sdk=$FLUTTER_ROOT" >> android/local.properties
🧹 Nitpick comments (1)
.github/workflows/store_deploy_android.yml (1)
50-60: Improve pubspec version parsing robustness with validation.Current parsing works for the existing
3.0.0+7version format, but the chain ofgrep | cut | tris fragile and lacks validation. The proposed improvements are beneficial defensive practices:
- Use
awkfor cleaner version extraction- Add explicit validation that
VERSION_CODEis numeric and present- Enable
set -euo pipefailto catch unset variables- Quote variables properly for shell safety
- Ensure
android/directory exists before writingThe diff provided implements these improvements correctly and should be applied.
Note: The workflow also uses
r0adkll/upload-google-play@v1withstatus: completed(line 109), which is valid and correct for internal track uploads.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/build_and_deploy.yml(3 hunks).github/workflows/run_tests.yml(2 hunks).github/workflows/store_deploy_android.yml(4 hunks).gitignore(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: M4dhav
Repo: AOSSIE-Org/Resonate PR: 510
File: .github/workflows/build_and_deploy.yml:31-36
Timestamp: 2025-08-31T16:18:53.594Z
Learning: For the AOSSIE-Org/Resonate project, build system requirements like Java version setup are considered separate from dependency update PRs and should be handled in dedicated PRs focused on build system improvements.
| deploy_github_release: | ||
| name: Deploy to GitHub Release | ||
| runs-on: ubuntu-latest | ||
| needs: build_android | ||
| permissions: | ||
| contents: write | ||
| env: | ||
| APK_PATH: app-release.apk | ||
| steps: | ||
| - name: Download APK artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: apk-release | ||
| path: ./ | ||
|
|
||
| - name: Get version from pubspec.yaml | ||
| id: version | ||
| run: | | ||
| VERSION=$(grep '^version:' pubspec.yaml | cut -d ' ' -f 2 | tr -d '\r') | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| if: github.event_name == 'push' | ||
|
|
||
| - name: Deploy to GitHub Release | ||
| uses: ncipollo/[email protected] | ||
| with: | ||
| allowUpdates: true | ||
| artifacts: ${{ env.APK_PATH }} | ||
| artifactContentType: apk | ||
| artifactContentType: application/vnd.android.package-archive | ||
| generateReleaseNotes: true | ||
| tag: latest_build | ||
| name: Latest Build | ||
| body: | | ||
| Latest build from ${{ github.ref_name }} branch | ||
| Commit: ${{ github.sha }} | ||
| Build Number: ${{ github.run_number }} |
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.
🧩 Analysis chain
🌐 Web query:
actions/upload-artifact@v4 actions/download-artifact@v4 nested paths directory structure
💡 Result:
Short answer — how paths/structure work with actions/upload-artifact@v4 and actions/download-artifact@v4:
-
upload-artifact@v4
- You give path(s) (file, dir, or glob). The action preserves the directory hierarchy relative to the upload root. If you pass multiple paths, the least common ancestor of those paths becomes the artifact root. If a glob contains a wildcard, the hierarchy is preserved only after the first wildcard (matching segments before the first wildcard are stripped). See README. [1]
-
download-artifact@v4
- By default downloading multiple artifacts creates a subdirectory per artifact under the provided path (e.g., path/Artifact-A/... and path/Artifact-B/...). Use merge-multiple: true to merge contents of multiple artifacts into the same target directory. You can also download a single artifact by name or id to a specified path. v4 artifacts are job-scoped and not cross-compatible with v3/v2. See README and changelog. [2][3]
Examples
- Upload a whole dir and preserve its tree:
- upload path: my/dir/ -> artifact will contain my/dir/… relative structure. [1]
- Upload with a glob that has a wildcard:
- path/to//dir/.txt → uploaded files flattened to some/dir/foo.txt (segments before first * are removed). [1]
- Download multiple artifacts into one folder:
- download with merge-multiple: true and path: out/ → all artifact contents merged into out/. Otherwise each artifact gets its own subfolder. [2]
References
- actions/upload-artifact README (v4). [1]
- actions/download-artifact README / examples (v4). [2]
- GitHub Changelog — Artifacts v4 GA (notes on job-scoped artifacts and v4 incompatibility). [3]
🏁 Script executed:
# Find the build_android job to see how the artifact is uploaded
grep -A 50 "build_android:" .github/workflows/build_and_deploy.yml | head -80Repository: AOSSIE-Org/Resonate
Length of output: 2058
🏁 Script executed:
# Check if pubspec.yaml is in the repository root
ls -la pubspec.yaml 2>/dev/null && echo "pubspec.yaml exists at root" || echo "pubspec.yaml not found at root"Repository: AOSSIE-Org/Resonate
Length of output: 152
🏁 Script executed:
# Get the complete build_android job including the upload-artifact step
grep -A 150 "build_android:" .github/workflows/build_and_deploy.yml | grep -B 150 "deploy_github_release:" | head -100Repository: AOSSIE-Org/Resonate
Length of output: 2721
Deploy job will fail: missing checkout for pubspec.yaml and incorrect APK artifact path.
The deploy_github_release job doesn't checkout the repository, causing the grep pubspec.yaml step to fail. Additionally, when build_android uploads build/app/outputs/flutter-apk/app-release.apk as a single file, download-artifact@v4 preserves the directory structure by default, placing the APK at build/app/outputs/flutter-apk/app-release.apk relative to the download path—not at the root. The APK_PATH: app-release.apk environment variable must be updated to reflect this.
deploy_github_release:
name: Deploy to GitHub Release
runs-on: ubuntu-latest
needs: build_android
permissions:
contents: write
env:
- APK_PATH: app-release.apk
+ APK_PATH: build/app/outputs/flutter-apk/app-release.apk
steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
- name: Download APK artifact
uses: actions/download-artifact@v4
with:
name: apk-release
path: ./🤖 Prompt for AI Agents
.github/workflows/build_and_deploy.yml lines 84-118: the deploy job fails
because it never checks out the repo before grepping pubspec.yaml and because
APK_PATH points to app-release.apk at repo root while download-artifact
preserves the original directory structure; add a checkout step (uses:
actions/checkout@v4) before the "Get version from pubspec.yaml" step so
pubspec.yaml is present, and update the env APK_PATH to the correct downloaded
location (build/app/outputs/flutter-apk/app-release.apk) so the release action
attaches the actual APK file.
| aossie-org-resonate-8a5edab282632443.txt | ||
| .github/instructions |
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.
Prefer a generalized ignore pattern (or add context) for the hash-like TXT file.
Ignoring a single specific filename is likely to go stale; consider ignoring a pattern (or adding a short comment explaining what generates it).
🤖 Prompt for AI Agents
In .gitignore around lines 56-57, the file
aossie-org-resonate-8a5edab282632443.txt is ignored by name which will become
stale; replace it with a generalized pattern such as aossie-org-resonate-*.txt
(or a regex-equivalent pattern) to catch future hash variants, or keep the
specific entry but add a short comment explaining what generates this filename
and why it's safe to ignore.
Description
Fixed the broken Build and Deploy workflow by adding necessary configuration steps and updating versions to match the current project setup.
Problem
The workflow was failing due to:
local.propertiesfile - Required by the new Gradle Kotlin DSL configuration insettings.gradle.ktswhich expectsflutter.sdkpathdeploy_github_releasejob referenced an env variable that wasn't in scopeflutter.versionNameandflutter.versionCodeweren't being set for Gradle buildsChanges Made
1. Build and Deploy Workflow (
.github/workflows/build_and_deploy.yml)local.propertiescreation step with proper Flutter SDK path and Android SDK configuration3.35.2to3.27.2(latest stable)21.0.6to21for better compatibility2. Store Deploy Workflow (
.github/workflows/store_deploy_android.yml)local.propertiescreation step with version extraction frompubspec.yaml3.27.2status: completedto Play Store upload for proper release statusSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.