-
Notifications
You must be signed in to change notification settings - Fork 0
feat: stamp release version into Android config at release build #19
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
fonkamloic
merged 7 commits into
ios-codepush-p0-p3-checkpoint
from
feat/android-release-stamp
Jun 12, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6fc9be5
Stamp release version into Android code push config at release build
fonkamloic 982af50
Address review: restore on write failure, surfaced restore errors, ve…
fonkamloic 24bdd46
Address review round 2: atomic stamp write, allow-list version valida…
fonkamloic 0cfaab6
style: format six checkpoint-lineage files to satisfy CI
fonkamloic 6a486d1
style: format with Dart 3.12.2 to match CI
fonkamloic 0fa4305
Revert "style: format with Dart 3.12.2 to match CI"
fonkamloic 77c7c13
style: format the five files CI flags (Dart 3.12.2 with resolved pack…
fonkamloic 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 |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| name: Claude Code Review | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, ready_for_review, reopened] | ||
|
|
||
| jobs: | ||
| claude-review: | ||
| # Repo secrets are not available to PRs from forks; skip them. | ||
| if: github.event.pull_request.head.repo.full_name == github.repository | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - uses: anthropics/claude-code-action@v1 | ||
|
fonkamloic marked this conversation as resolved.
fonkamloic marked this conversation as resolved.
|
||
| with: | ||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
| prompt: | | ||
| REPO: ${{ github.repository }} | ||
| PR NUMBER: ${{ github.event.pull_request.number }} | ||
|
|
||
|
fonkamloic marked this conversation as resolved.
|
||
| Review this pull request as a senior Dart/Flutter engineer. Focus on: | ||
| - Correctness bugs and edge cases in the changed code | ||
| - API misuse and error-handling gaps | ||
| - Security issues (credential handling, injection, unsafe file I/O) | ||
| - Backwards compatibility for existing users of this package | ||
|
|
||
| Use `gh pr comment` for overall feedback and | ||
| `mcp__github_inline_comment__create_inline_comment` (with confirmed: true) | ||
| for line-specific issues. Only post GitHub comments — do not submit | ||
| review text as plain messages. Be concise; skip pure style nits. | ||
| claude_args: | | ||
| --model claude-sonnet-4-6 | ||
| --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" | ||
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
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
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
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 |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import 'dart:io'; | ||
|
|
||
| const String kDefaultAndroidCodePushYamlPath = | ||
| 'android/app/src/main/assets/codepush.yaml'; | ||
|
|
||
| /// Stamps [releaseVersion] into the Android code push config asset so the | ||
| /// built APK carries the version it is released as. Returns the original | ||
| /// file content for restoring afterwards, or `null` when the file does not | ||
| /// exist (code push has not been initialized for Android). | ||
| String? writeReleaseVersionToAndroidYaml( | ||
| String releaseVersion, { | ||
| String yamlPath = kDefaultAndroidCodePushYamlPath, | ||
| }) { | ||
| if (!RegExp(r'^[A-Za-z0-9._+\-]+$').hasMatch(releaseVersion)) { | ||
| throw ArgumentError.value( | ||
| releaseVersion, | ||
| 'releaseVersion', | ||
| 'contains characters that would break the YAML config', | ||
| ); | ||
| } | ||
|
|
||
| final yamlFile = File(yamlPath); | ||
| if (!yamlFile.existsSync()) return null; | ||
|
|
||
| final originalContent = yamlFile.readAsStringSync(); | ||
| var content = originalContent; | ||
| final versionLine = 'release_version: "$releaseVersion"'; | ||
|
fonkamloic marked this conversation as resolved.
|
||
|
|
||
| if (RegExp(r'^release_version:', multiLine: true).hasMatch(content)) { | ||
| content = content.replaceFirst( | ||
| RegExp(r'^release_version:.*$', multiLine: true), | ||
| versionLine, | ||
|
fonkamloic marked this conversation as resolved.
|
||
| ); | ||
| } else { | ||
| if (content.isNotEmpty && !content.endsWith('\n')) content += '\n'; | ||
| content += '$versionLine\n'; | ||
| } | ||
|
|
||
| // Write to a temp file and rename over the original: a failed write | ||
| // (disk full, permissions) can then never corrupt the config, and the | ||
| // original error propagates without a doomed in-place rescue attempt. | ||
| final tempFile = File('$yamlPath.tmp'); | ||
|
fonkamloic marked this conversation as resolved.
fonkamloic marked this conversation as resolved.
|
||
| try { | ||
| tempFile.writeAsStringSync(content); | ||
| tempFile.renameSync(yamlPath); | ||
| } on FileSystemException { | ||
| try { | ||
| tempFile.deleteSync(); | ||
| } on FileSystemException { | ||
| // Best-effort cleanup; the original config is untouched either way. | ||
| } | ||
| rethrow; | ||
|
fonkamloic marked this conversation as resolved.
|
||
| } | ||
| return originalContent; | ||
| } | ||
|
|
||
| void restoreAndroidYaml( | ||
|
fonkamloic marked this conversation as resolved.
|
||
| String originalContent, { | ||
| String yamlPath = kDefaultAndroidCodePushYamlPath, | ||
| }) { | ||
| File(yamlPath).writeAsStringSync(originalContent); | ||
|
fonkamloic marked this conversation as resolved.
fonkamloic marked this conversation as resolved.
fonkamloic marked this conversation as resolved.
|
||
| } | ||
|
fonkamloic marked this conversation as resolved.
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.