-
Notifications
You must be signed in to change notification settings - Fork 47
feat: Single source of truth release - config.gradle triggered #104
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
Conversation
- Automatically creates git tags when version changes in config.gradle
- Monitors config.gradle changes on main branch
- Creates annotated tags in format v{version}
- Triggers release workflow automatically via tag creation
- Prevents duplicate tags and provides clear status summaries
- Removes separate version-change-trigger.yml workflow - Adds auto version update step directly in release.yml prepare job - Automatically updates config.gradle when tag version differs - Ensures all build jobs use updated version from main branch - Prevents version mismatch issues like the v2.3.4 incident - Simplifies release process - just create tag and everything updates automatically
- Add release-on-version-change.yml that monitors config.gradle changes - Auto-creates tags when version is updated in config.gradle - Simplifies release.yml by removing version update logic - Better workflow: update version -> auto tag -> auto release
- Merge version change detection directly into release.yml - Remove separate release-on-version-change.yml workflow - Fix Copilot review comments: - Handle first commit case properly (no HEAD~1) - Use more robust regex patterns for gradle parsing - Add tag existence check to prevent race conditions - Workflow now triggers on: - Tag push (v*) - config.gradle changes on main branch - Manual workflow dispatch - Auto-creates tags when version increases in config.gradle
- Remove tag push trigger completely - Keep only config.gradle as trigger source - Auto-create tags when version increases - Prevent duplicate releases with tag existence check - Manual workflow dispatch still available for re-runs This ensures config.gradle is the ONLY source of truth for releases
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.
Pull Request Overview
This PR implements a single source of truth release system where changes to config.gradle on the main branch automatically trigger releases, eliminating the need for manual tag management.
- Changes trigger mechanism from tag-based to config.gradle file changes on main branch
- Adds version comparison logic to detect version increases and auto-create tags
- Updates all jobs to conditionally run based on version change detection
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
.github/workflows/release.yml
Outdated
| if: github.event_name == 'push' | ||
| run: | | ||
| # Get current version from config.gradle | ||
| CURRENT_VERSION=$(grep versionName config.gradle | sed -E 's/.*versionName:\s*"([^"]+)".*/\1/') |
Copilot
AI
Sep 10, 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.
The grep command will fail silently if no match is found, resulting in an empty CURRENT_VERSION. This could lead to incorrect version comparison logic. Add error handling to ensure the version is properly extracted.
.github/workflows/release.yml
Outdated
| echo "Current: v$CURRENT_VERSION (code: $CURRENT_CODE)" | ||
| # Check if version increased | ||
| if [ -n "$CURRENT_VERSION" ] && [ "$CURRENT_CODE" -gt "$PREV_CODE" ]; then |
Copilot
AI
Sep 10, 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.
The condition only checks if CURRENT_VERSION is non-empty but doesn't validate CURRENT_CODE. If CURRENT_CODE extraction fails and becomes empty, the numeric comparison will fail. Add validation for both CURRENT_CODE and ensure it's a valid number before the comparison.
.github/workflows/release.yml
Outdated
| run: | | ||
| # Extract version code from config.gradle | ||
| VERSION_CODE=$(grep "versionCode:" config.gradle | sed 's/.*versionCode: \([0-9]*\).*/\1/') | ||
| VERSION_CODE=$(grep "versionCode:" config.gradle | sed -E 's/.*versionCode:\s*([0-9]+).*/\1/') |
Copilot
AI
Sep 10, 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.
This version code extraction logic is duplicated from line 59. Consider extracting this into a reusable function or using the already computed value from the check_version step to avoid duplication and potential inconsistencies.
| if git ls-remote --tags origin | grep -q "refs/tags/${TAG_NAME}$"; then | ||
| echo "⚠️ Tag $TAG_NAME already exists" | ||
| exit 0 | ||
| fi |
Copilot
AI
Sep 10, 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.
Exiting with code 0 when a tag already exists will mark the step as successful, but subsequent jobs expecting a new tag to be created may fail or behave unexpectedly. Consider using a different exit code or setting an output variable to communicate this state to dependent jobs.
- Add error handling for grep commands with validation - Validate version code is a valid number before comparison - Remove duplicate version code extraction logic - Fix tag exists exit code to use output variables instead All 4 new Copilot comments have been addressed with proper error handling
Summary
This PR implements a single source of truth release system where
config.gradleis the ONLY trigger for releases.✨ Key Design: config.gradle as Single Source
NO tag triggers - Only config.gradle changes trigger releases:
How It Works
graph LR A[Update config.gradle] --> B[Push to main] B --> C[Detect version increase] C --> D[Auto-create tag] D --> E[Build & Release] F[Manual dispatch] --> EImplementation Details
config.gradlechanges to main branchFixes Copilot Comments
✅ First commit handling: Proper HEAD~1 existence check
✅ Robust parsing: Extended regex for gradle files
✅ Race condition prevention: Tag existence verification
Usage
Primary Method: Version-driven
Manual Re-run
Use GitHub Actions UI for re-running failed releases
Benefits
Testing
This eliminates all version sync issues by having ONE authoritative source!