patterngitMinor
When to "npm publish" when using git flow
Viewed 0 times
publishflownpmusinggitwhen
Problem
I'm using the following resources as a guide to git flow:
However, none of them explicitly mention at what point you perform the npm publish from. Do you do this after you have bumped the version number but before you finish the release? This would mean the publish is coming from the release branch. Or do you finish the release then perform the publish from the master branch?
Thanks.
- git-flow cheatsheet
- git-flow
- Using git-flow to automate your git branching workflow
However, none of them explicitly mention at what point you perform the npm publish from. Do you do this after you have bumped the version number but before you finish the release? This would mean the publish is coming from the release branch. Or do you finish the release then perform the publish from the master branch?
Thanks.
Solution
I'd set up my CI system to do this on every commit to
The first very straightforward reason for this is that the commit to
The second reason is that it is a very simple rule that can be automated. If you do any amount of final testing on the release branch, you need to make a manual decision as to whether or not you can release or not; your CI system (probably) can't make that decision just based on the presence of a release branch. On the other hand, since every commit to
master, that is, after the release branch merges.The first very straightforward reason for this is that the commit to
master gets tagged with the release, and you want the thing you ultimately publish to match exactly the version of the source code at the tag. While there shouldn't be any merge surprises if git flow is run perfectly, it's still better to publish the content of a tag and not the commit immediately before a merge.The second reason is that it is a very simple rule that can be automated. If you do any amount of final testing on the release branch, you need to make a manual decision as to whether or not you can release or not; your CI system (probably) can't make that decision just based on the presence of a release branch. On the other hand, since every commit to
master is merging in a release (or hotfix) branch that you've fully validated, the commit itself is a signal that you're ready to release.Context
StackExchange DevOps Q#10077, answer score: 4
Revisions (0)
No revisions yet.