wordpress-mobile / release-toolkit-gutenberg-mobile

Automation Scripts for Releasing Gutenberg-Mobile Updates to the WordPress Mobile Apps.
Mozilla Public License 2.0
5 stars 2 forks source link

[CLI] Add support for preparing GB patch releases #212

Closed jhnstn closed 9 months ago

jhnstn commented 9 months ago

Fixes #153

This updates the prepare gb command to accept patch versions (e.g. 1.1071) and a prs flag to pass a comma separated list of PRs on gutenberg

If the command recognizes a patch release it will branch of the prior release and then attempt cherry pick the merge commits from the passed in PRs.

If there is a merge commit the script will prompt to resolve the merge commit in the users default $EDITOR. if EDITOR is not set, the script will prompt for a command to open the conflicting files (e.g. vim or code )

Once the branch is prepared the script will prompt to edit the changelog since the changelog might not accurately reflect the changes in the patch.

Testing

This is difficult to completely verify with out getting noisy on the Gutenberg repo. Also this is difficult to set up on forked repos. I suggest using the WordPress/gutenberg to test but just make sure to exit the script when prompted to create the pr i.e. a this prompt "Ready to create the PR on WordPress/gutenberg? [y/n]"

I also found it is easier to verify the scripts correctness by trying to recreate existing patch releases.

Testing with merge conflicts

Testing with multiple PRs

Verifying the branching (also test with out merge conflicts)

Testing the editor prompt

Regression

Note : There is no verification that a merge conflict was correctly resolved. I suspect most conflicts will be in the change notes so the last verification step should surface any issues with that file.

Note: The editor prompts have only been tested with vim,code and nano but in theory any command that takes a list of files should work.

jhnstn commented 9 months ago

Looks good! I was able to run through all of the patch scenarios successfully. I think I encountered a regression with the prepare all command, however:

➜ yes | GBM_WPMOBILE_ORG=derekblank GBM_WORDPRESS_ORG=derekblank go run main.go release prepare all 1.110.0
[INFO] Preparing Gutenberg for release 1.110.0
[INFO] Cloning Gutenberg to /var/folders/xk/xmtl5xjx33v_bp94749wm0j00000gn/T/gbm-2609010841/gb
Cloning into '.'...
warning: Could not find remote branch  to clone.
fatal: Remote branch  not found in upstream origin
[ERROR] error cloning the Gutenberg repository: exit status 128

This happens on both the main repos and my forked repos. I think this might be coming from build.Base.Ref. Is prepare all still a command, or should we run them individually as gb and gbm? If we're running them individually, we should remove all and update the docs.

Ah thanks for checking that @derekblank ! I forgot to update the all command. I can push a fix.

jhnstn commented 9 months ago

@derekblank I fixed the regression in https://github.com/wordpress-mobile/release-toolkit-gutenberg-mobile/pull/212/commits/696857cbc0f2f1859b26ebb875da6acdde82abad