Skip to content
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

Add nvm use and auto-branching #86

Merged
merged 26 commits into from
Sep 23, 2024
Merged

Conversation

message-dimke
Copy link
Contributor

@message-dimke message-dimke commented Oct 22, 2023

Changes proposed in this Pull Request:

This PR extends release command with additional parameters

--nvm_use        - used to tell `release` to use `nvm use` per project basis.
--default_branch - used to pass project's default repo branch name into `release` command.

PR also adds few commands to be using as complementary commands to the overwritten release command:

simulate - used to run simulation mode on the new release command.
branch   - used to add a dialog for release branch creation.

Added set of tools for Git, Nvm and Product.

It is now possible to run the release and simulate commands using new parameters and see some changes in the command workflows.

./bin/wr simulate --nvm_use --default_branch develop --generate_changelog --wc_tested 8.3 --wp_tested 6.4 https://github.com/woocommerce/pinterest-for-woocommerce/tree/testrelease/1.3.13

For example if you provide a GitHub url using a branch name which does not exist on the repository, you will see a prompt to create it and release from there.

Terminal

It is also possible to skip release branch creation and release from the default which is set to develop by default. All you need is to refuse release branch creation.

Terminal

The invisible part of changes introduced with this PR is nvm use command to run for every releasing product being inside the corresponding product directories to switch the release process to a proper node and npm versions. If --nvm_use flag is provided into release command, the additional logic will get involved into build process, if not - then the release will flow as usual.

Detailed test instructions:

  1. Checkout add-nvm-and-autobranching branch.
  2. Open release.txt in the root and add some lines to it.
pinterest-for-woocommerce	1.3.13	testrelease/1.3.13
woocommerce-brands	1.6.62	testrelease/1.6.62

Note: I am using Pinterest and Brands here because both projects have to use their own node version and w/o nvm use the build will fail. Pinterest can build with node 14 when Brands require node 16 for release.

You can provide any nonsense instead of a release branch names to check how branch prompt is working.
3. Run bulk command

./bin/wr bulk simulate --generate_changelog --wc_tested 8.3 --wp_tested 6.4

Note: I am using bulk command here as a single command to work with release.txt. Also you may notice --wc_tested and --wp_tested flags, those are also here to check version bump still functional.
4. While releasing wait for a branch creation prompt to appear.
5. Choosing y will start a branch creation process. Branch will be created from a default one and pushed to remote. The push is requires for a changelog command to generate its changelog part.
6. Choosing N will drop release branch creation process and prompt to release from a default branch which is, if rejected, will terminate the release process.
7. When running the simulation every release branch, except the default, must be cleaned up automatically at the end of the process.
8. All the steps are followed with the corresponding console messages/notifications/errors.

Additional details:

Changelog entry

Dev - Adding auto-release branching.
Dev - Adding nvm use on product basis.

- Adding default branches for extensions maintainer by Ventures.
- Replacing WooRelease `release` command with the local one.
- Adjusting bulk command to call release with additional parameters.
- Adjusting release command to create release branch or fallback to the default repo branch and run nvm use if selected.
@message-dimke message-dimke added the type: enhancement The issue is a request for an enhancement. label Oct 22, 2023
@message-dimke message-dimke self-assigned this Oct 22, 2023
Copy link
Contributor

@JPry JPry left a comment

Choose a reason for hiding this comment

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

I know this is progress, and I'm not able to dedicate time to a full review right now, but I just wanted to leave a few comments.

extensions.json Outdated Show resolved Hide resolved
packages/php/woorelease-extension/src/Utils/Nvm.php Outdated Show resolved Hide resolved
packages/php/woorelease-extension/src/Commands/Release.php Outdated Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
bin/wr Outdated Show resolved Hide resolved
packages/php/woorelease-extension/src/Utils/Git.php Outdated Show resolved Hide resolved
packages/php/woorelease-extension/src/Utils/Git.php Outdated Show resolved Hide resolved
packages/php/woorelease-extension/src/Utils/Nvm.php Outdated Show resolved Hide resolved
- Renaming some method names to be grammatically correct.
- Separating create and push branch commands into different methods.
… providing a release branch name which, if does not exist, is prompted to get created or fallbacks to default. This means the parameter to create a release branch is redundant.
…ust commands to use the newly added shell script. Adding custom `simulate` command which inherits from the overwritten `release` command to allow simulation runs. Update `branch` command by adding cleanup option to it.
…t. Create custom product build function to handle cases with and w/o nvm.
…ning the build. Using application's meta storage to pass branches between `branch` and `release` commands. Adjusting release branches cleanup to make sure not to cleanup the default branch from the product's repo.
@message-dimke message-dimke marked this pull request as ready for review November 7, 2023 14:01
@message-dimke message-dimke requested review from JPry and a team and removed request for JPry November 7, 2023 14:03
@rawdreeg rawdreeg self-requested a review March 28, 2024 13:58
Copy link
Contributor

@rawdreeg rawdreeg left a comment

Choose a reason for hiding this comment

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

Sorry for the delay. This has been in my to-do list for a while lol.

Looks good, all the previous feedback and nits are now fixed, and I couldn't find any other issue.

While testing this I encountered #99 and I submitted a PR fixing it (#100). So I'll approve this!

- Updating `woorelease` dev-trunk dependency version since the last release was back 2022.
@message-dimke message-dimke merged commit 6ba839e into trunk Sep 23, 2024
1 check passed
@message-dimke message-dimke deleted the add-nvm-and-autobranching branch September 23, 2024 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants