Skip to content

Conversation

bsgrigorov
Copy link
Contributor

@bsgrigorov bsgrigorov commented Jul 12, 2025

Summary

JIRA: INFRA-2772

This PR adds automatic main branch version bumping to the create-release-pr.yml workflow to resolve nightly build version conflicts.

Problem

Each nightly build needs to be one minor version ahead of the current release candidate. Previously, after cutting a release branch, the main branch version had to be manually bumped to prevent conflicts with future nightlies.

Example Issue: If RC is 12.23.0, nightly builds should be 12.24.0-<unique-id>, but without version bumping, nightlies were conflicting because they weren't correctly versioned above the RC.

Solution

Added a new job bump-main-version that:

Automated Version Calculation

  • Uses Node.js semver library to increment minor version
  • Example: 12.23.012.24.0

Platform Consistency

  • Uses existing set-semvar-version.sh script for version updates
  • Supports both mobile and extension platforms
  • Updates all platform-specific files (package.json, build.gradle, etc.)

Manual Oversight

  • Creates PR for manual review by release manager
  • Includes detailed description explaining the need for version bump
  • Adds appropriate labels (release-management, version-bump)

Workflow Changes

The workflow now has two jobs:

  1. create-release-pr - Creates the release PR (existing functionality)
  2. bump-main-version - Creates version bump PR for main branch (new)

Example Flow

  1. Release manager triggers workflow with version 12.23.0
  2. Release PR created on branch release/12.23.0
  3. NEW: Version bump PR created on bump-main-version-12.24.0
    • Updates main branch version to 12.24.0
    • Ready for manual review and merge

Benefits

  • 🌙 Nightly builds: Ensures proper version hierarchy
  • 🔄 Automation: Eliminates manual version bump step
  • 🛡️ Conflict prevention: Prevents release/nightly version conflicts
  • 📱 Platform alignment: Maintains mobile/extension version sync
  • 👥 Team efficiency: Reduces manual overhead for release managers

Testing

  • Workflow syntax validation
  • Error handling for existing branches/PRs
  • Semver calculation logic
  • Integration with existing set-semvar-version.sh script

Related


This change automates the post-release version bump process while maintaining necessary manual oversight for release management.

@bsgrigorov bsgrigorov self-assigned this Jul 12, 2025
alucardzom
alucardzom previously approved these changes Jul 14, 2025
@bsgrigorov
Copy link
Contributor Author

I updated the create-release-pr.sh script with some improvements and new functionality. Here is a comparison with the old script:

🔍 Comprehensive Comparison Analysis

 PRESERVED FUNCTIONALITY

1. Input Validation & Parameters - ✅ IDENTICAL

  • Both scripts have identical parameter validation
  • Same error handling for missing parameters
  • Same mobile platform requirement for NEW_VERSION_NUMBER

2. Helper Functions - ✅ ENHANCED

  • get_expected_changed_files() - Identical
  • get_release_branch_name() - Enhanced with test mode support
  • NEW: get_next_version() - Added for version bump functionality
  • NEW: get_version_bump_branch_name() - Added for version bump

3. Git Configuration - ✅ PRESERVED

  • Same git user configuration (metamaskbot)
  • Same email configuration
  • Same git fetch behavior

4. Release Branch Logic - ✅ IMPROVED

  • Old: Inline checkout logic
  • New: Extracted to create_release_pr() function with helper checkout_or_create_branch()
  • Enhancement: Better error handling and branch existence checking

5. Version Updates - ✅ PRESERVED

  • Same call to set-semvar-version.sh
  • Same file staging logic
  • Same commit message generation (mobile vs extension)

6. Release PR Creation - ✅ ENHANCED

  • Same PR body content with team checklist
  • Same draft PR creation
  • Enhancement: Extracted to helper function with better error handling
  • Enhancement: Uses create_pr_if_not_exists() helper

 CHANGELOG FUNCTIONALITY COMPARISON

Original Changelog Logic - ✅ FULLY PRESERVED

  • Same branch existence checking
  • Same auto-changelog execution
  • Same yarn/corepack setup
  • Same test plan generation
  • Same Google Sheets integration (when not in test mode)
  • Same commit and push logic
  • Same PR creation logic

Key Preservation:

  • Same npx @metamask/auto-changelog@4.1.0 call
  • Same yarn workspace commands
  • Same CSV file handling
  • Same PR body format

🆕 NEW FUNCTIONALITY ADDED

1. Version Bump for Main Branch - ✅ MAJOR ENHANCEMENT

  • NEW: create_version_bump_pr() function
  • Creates a third PR to bump main branch version after release
  • Prevents version conflicts between release and nightly builds
  • Uses semantic versioning (increments minor version)

2. Modular Architecture - ✅ IMPROVEMENT

  • NEW: Helper functions (checkout_or_create_branch, push_branch_with_handling, create_pr_if_not_exists)
  • NEW: Workflow functions (create_release_pr, create_changelog_pr, create_version_bump_pr)
  • NEW: Main orchestration function with clear step-by-step execution
  • NEW: Support for sourcing script without execution

3. Test Mode Support - ✅ ENHANCEMENT

  • NEW: TEST_ONLY environment variable support
  • NEW: Test branch naming (release-testing/, version-bump-testing/)
  • NEW: Skips changelog generation in test mode
  • NEW: Skips Google Sheets updates in test mode

4. Better Error Handling - ✅ IMPROVEMENT

  • Enhanced: Branch existence checking
  • Enhanced: Push error handling
  • Enhanced: PR existence checking
  • Enhanced: Commit error handling

🔧 TECHNICAL IMPROVEMENTS

1. Code Organization - ✅ BETTER

  • Old: Monolithic script with inline logic
  • New: Modular functions with clear separation of concerns
  • Better maintainability and testability

2. DRY Principle - ✅ IMPROVED

  • Old: Repeated git and GitHub CLI operations
  • New: Abstracted into reusable helper functions
  • Reduced code duplication

3. Variable Handling - ✅ SAFER

  • Fixed: Backtick escaping in PR body templates
  • Enhanced: Local variable usage in functions
  • Enhanced: Parameter passing between functions

⚠️ POTENTIAL CONCERNS CHECKED

1. Missing Functionality - ✅ NONE FOUND

  • All original functionality is preserved
  • No features were removed or modified negatively

2. Behavior Changes - ✅ ONLY POSITIVE

  • Enhanced error handling (improvement)
  • Added test mode support (improvement)
  • Added version bump functionality (enhancement)
  • Better branch management (improvement)

3. Breaking Changes - ✅ NONE

  • Same command-line interface
  • Same parameter requirements
  • Same environment variable usage
  • Backward compatible

📊 SUMMARY

Aspect | Old Script | New Script | Status -- | -- | -- | -- Core Functionality | ✅ Present | ✅ Present | Preserved Release PR Creation | ✅ Basic | ✅ Enhanced | Improved Changelog PR Creation | ✅ Present | ✅ Present | Preserved Version Bump | ❌ Missing | ✅ Added | Enhancement Test Mode | ❌ Limited | ✅ Full Support | Enhancement Error Handling | ⚠️ Basic | ✅ Robust | Improved Code Organization | ⚠️ Monolithic | ✅ Modular | Improved Maintainability | ⚠️ Difficult | ✅ Easy | Improved

🎉 CONCLUSION

✅ NO NEGATIVE CHANGES DETECTED

  • All original functionality is fully preserved
  • Multiple enhancements and improvements added
  • Better error handling and code organization
  • Significant new feature (version bump) addresses the original requirement
  • Script is now more robust, testable, and maintainable

The new script successfully:

  1. ✅ Preserves 100% of original functionality
  2. ✅ Adds the requested version bump feature
  3. ✅ Improves error handling and robustness
  4. ✅ Maintains backward compatibility
  5. ✅ Enhances testability and maintainability

This is a successful refactoring with no missing functionality and significant improvements! 🚀

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@bsgrigorov bsgrigorov force-pushed the feat/INFRA-2772-add-main-version-bump-to-release-workflow branch from 554b368 to 2768413 Compare July 15, 2025 07:28
cursor[bot]

This comment was marked as outdated.

@sethkfman
Copy link
Contributor

Copy link
Contributor

@sethkfman sethkfman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - for the mobile repo

@bsgrigorov bsgrigorov merged commit dde6d53 into main Jul 15, 2025
19 checks passed
@bsgrigorov bsgrigorov deleted the feat/INFRA-2772-add-main-version-bump-to-release-workflow branch July 15, 2025 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants