Skip to content

feat(gh-action): create workflow for automatize stable-main creation#69

Merged
alucardzom merged 29 commits into
mainfrom
ale/infra-2532-master-sync-pr
May 16, 2025
Merged

feat(gh-action): create workflow for automatize stable-main creation#69
alucardzom merged 29 commits into
mainfrom
ale/infra-2532-master-sync-pr

Conversation

@alucardzom
Copy link
Copy Markdown
Contributor

@alucardzom alucardzom commented May 13, 2025

This PR is intended to add as functionality a workflow call that will:

  • Create a stable-main-{release} branch
  • Run the script that will ensure the branch will from a known good state and will take specific files from the stable branch
  • Create a PR against main

Examples made on a forked metamask-mobile repo:
https://github.com/MetaMask/experimental-metamask-mobile-dso-tests/actions/runs/15068855926

Summary

This file (stable-sync.js) is a script that synchronizes changes between the main and stable branches. Here's a breakdown of what it does:

Branch Management:

  • Takes a branch name as an argument (defaults to 'stable-main' if not provided)
  • Checks if the branch exists
  • If it exists, checks it out
  • If it doesn't exist, creates a new branch

Synchronization Process:

  • Fetches the latest changes from the remote repository
  • Resets the branch to match the stable branch
  • Attempts to merge changes from main into the branch
  • Handles merge conflicts if they occur (simple ones)

File Preservation:

Preserves specific files from the stable branch:

  • CHANGELOG.md
  • bitrise.yml
  • android/app/build.gradle
  • ios/MetaMask.xcodeproj/project.pbxproj
  • package.json

This ensures that version numbers and build configurations from the stable branch are maintained

Commit and Push:

  • Adds all changes to the staging area
  • Checks if there are any changes to commit
  • If there are changes, commits them with a message indicating the merge
  • If the CREATE_BRANCH environment variable is set to 'true', pushes the branch to the remote repository

Error Handling:

  • Catches and logs errors during the process
  • Exits with an error code if a critical step fails

This script is part of MetaMask's release management process, helping to maintain consistency between the main and stable branches while preserving important configuration files.

alucardzom added 29 commits May 13, 2025 14:30
This PR is intended to add as functionality a workflow call that will:

- Create a `stable-main-{release}` branch
- Run the script that will ensure the branch will from a known good
  state and will take specific files from the stable branch
- Create a PR against `main`
To accept as input the semver from the repo
@alucardzom alucardzom marked this pull request as ready for review May 16, 2025 14:23
@Qbandev
Copy link
Copy Markdown
Contributor

Qbandev commented May 16, 2025

Can you show how this was tested?

Comment thread .github/workflows/stable-sync.yml
@alucardzom
Copy link
Copy Markdown
Contributor Author

Can you show how this was tested?

@Qbandev it's documented into the ticket:
https://consensyssoftware.atlassian.net/browse/INFRA-2532

As I already did a bunch of tests, I'll paste in the description the latest ones, but more info about the tests I made can be found there.

@alucardzom alucardzom merged commit 990a758 into main May 16, 2025
18 checks passed
@alucardzom alucardzom deleted the ale/infra-2532-master-sync-pr branch May 16, 2025 15:00
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.

3 participants