-
Notifications
You must be signed in to change notification settings - Fork 134
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
ci: support releases with branch-protection #1458
ci: support releases with branch-protection #1458
Conversation
run: npm run ci:release | ||
|
||
- name: Setup credentials |
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.
See ternary operation in the top-level env section
I agree, I don't see any problem with having 2 manual steps (pre-release, and release). We can revisit this in the future if we believe that automating the second step is essential. So, If I understand, the flow will be something like this:
Is this correct? Edit: I was checking the code, and I believe the tags will be created in the PR. The tags will need to be associated to the latest commit in main instead (which will be the merge commit of the PR). I'm saying this, because I saw the "lerna version" (creating the tags) in the pre-release, rather than creating them in the release.mjs file. |
Good point. When I tested this out I merged with rebase and things were ok:
But I'm now a bit confused whether that behaviour might be different if using Let me explore whether I can change this to use |
cdc989e is the one to avoid tagging during the For example, in my playground, I ran:
There is one thing that I could not figure out and was the one regarding tagging the package named https://github.com/v1v/test-2fa/tree/master/packages/test-2fa-foo for some reason it only tagged the main package called https://github.com/v1v/test-2fa/tree/master/packages/test-2fa-bar I don't know whether tagging all the packages is a hard requirement. @devcorpio , I need your thoughts |
Does both of the package had changes? Can you point us to the commit where this happened? Thanks. |
No code changes in any of those packages. Aha, that might be the reason. I've just tried some code changes with v1v/test-2fa#61 Then I ran the prepare-release produced v1v/test-2fa#62 IIUC, Finally, I'll need to explore this workaround, somehow while I'd have expected the same versions as defined in v1v/test-2fa#62 I'll transition this PR to a draft PR. |
I followed the steps explained in lerna/lerna#1957 (comment) and it worked like a charm: v1v/test-2fa#65 was created and when merged then the
And publish them in npmjs: |
apologies for the delay, this afternoon/evening I will add the results of a few tests I'm doing with the current (the "old" one) Lerna setup But from what I see of the new process, everything looks awesome. |
1. Changing a package which no other package depends on (e.g. apm-rum-react) Result: Lerna only versions the mentioned package. 2. Changing a package which other packages depend on (e.g. apm-rum-core) Result: Lerna versions the package I modified and the ones that depend on the modified package. Conclusion: The behaviour you see in the tests you are doing is correct. 🚀 One last test that you might do (if you have time) is to modify one of your packages to depend on another one, and then see if the behaviour that I just described (case 2) is reproduced, too |
Great work @v1v 🎉 One more thing I would like to check is whether our publishing for single package works after this change? Line 14 in 7cd5f5e
Its not a huge deal if we cant make it work and not a requirement unless we need a real emergency situation. But just want to bring it to your notice. |
Pushing directly to the main branch is not allowed; therefore the script will not work with the default lerna.json. |
Given the new package and its dependency; see https://github.com/v1v/test-2fa/pull/66
When I run the pre-release workflow; see https://github.com/v1v/test-2fa/actions/runs/7245859854
Then https://github.com/v1v/test-2fa/pull/67 is created
test-2fa-bar@2.1.4
test-2fa-dependent@1.0.1
test-2fa-foo@3.5.0 Given https://github.com/v1v/test-2fa/pull/67
When it's merged
And I run the release workflow; see https://github.com/v1v/test-2fa/actions/runs/7245876059
Then, the artifacts are published
Found 3 packages to publish:
- test-2fa-bar => 2.1.4
- test-2fa-dependent => 1.0.1
- test-2fa-foo => 3.5.0 |
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.
LGTM! 🎉
this week (perhaps the next one) we will do our first release with this system. We want to release the changes of this PR (once it's approved & merged)
Awesome! ❤️ I'll be on Christmas break for two weeks starting early next week. Feel free to merge this PR and run the first release with it, if something goes terribly wrong @amannocci is around, so feel free to reach him. Or, if needed, please feel free to revert this PR or wait until I'm back, whatever it suits you. Other than that, have a lovely 🎄 time 🙇 |
thank you! Have a lovely 🎄 you too 🎉 |
To avoid bumping the versions
a338743
to
ee3eb33
Compare
excellent! The release process worked! 🎉 🥳
--
Example:
|
What
Split the release workflow in a different set of actions:
Why
There is a hard requirement to review every single change through a Pull Request. Hence releases cannot commit directly to the repository.
Implementation details
I split https://github.com/lerna/lerna/tree/main/libs/commands/publish#readme in two steps:
lerna version
to prepare the changes in a different branch and then create a PR with those changeslerna publish
with some flags to avoid pushing to git https://github.com/lerna/lerna/tree/main/libs/commands/version#--no-git-tag-version and https://github.com/lerna/lerna/tree/main/libs/commands/version#--no-pushRationale
Rather than automating the
release
step when the PR is merged, I decided to keep it simple and have two workflows that need to be triggered manually.We can think about automating the execution of the second one when the PR is merged... but I didn't want to get to creative for the shake of simplicity.
Test
https://github.com/v1v/test-2fa