Lerna: [version/publish] should be able to work with merged tags

Created on 25 Oct 2018  路  3Comments  路  Source: lerna/lerna

Expected Behavior

We should be able to commit publishing changes (tags and version changes) through a pull request merge.

Our flow is the following. When we merge our PRs into master, our ci runs the publishing job. Due to SOC2 compliance, and other security reasons, we cannot publish from the master branch, as only PRs are allowed with proper approval and status checks.
So we create branch for publishing, so we want explicitly tell to lerna that it's ok to compare with merged tags (i.e. skipping first-parent param for git describe)
As we make sure that this would be safe, and as we cannot keep one publishing branch (master or other) we expect an option to be able to compare with merged tags.

Current Behavior

Currently lerna changed lists all the packages, as we are not publishing from master

Possible Solution

A possible solution would be a new option, like in this PR: #1712
The option include-merged-tags in the above PR is exactly what we need

lerna.json


{
  "lerna": "3.4.2",
  "packages": [
    "packages/*"
  ],
  "version": "independent",
  "command": {
    "publish": {
      "registry": "https://artifactory...",
      "bump": "patch"
    }
  }
}

Context



Browsing around lerna issues I saw many times that we shouldn't publish from release branches. I totally got it, there should be a dedicated branch (master in our case). The problem is, when you have to protect your branches, so only PRs are allowed, and you cannot have two PRs with the same HEAD, so you have to create new branches.
Honestly, I love lerna, it changed the way we handle our packages (a nice monorepo with growing number of packages), but since the first-parent check we struggle writing complicated stuff to prevent us to trigger hundreds of Jenkins jobs on not changed packages.
Also lerna changed command would be very useful to narrow down downstream ci tasks for changed packages, but now it's very complicated to do it (e.g. "${LERNA}" exec --since "${latest_tag}" --loglevel=silent -- pwd | sed 's|^.*/packages/||g' | sed -e 's/^/@our_scope\//')

Your Environment

| Executable | Version |
| ---: | :--- |
| lerna --version | 3.4.2 |
| npm --version | 6.4.1 |
| node --version | 10.10.0 |

Most helpful comment

Same problem here. We currently workaround with patch-package and removing the --first-parent flag from @lerna/describe-ref/lib/describe-ref.js

All 3 comments

Same problem here. We currently workaround with patch-package and removing the --first-parent flag from @lerna/describe-ref/lib/describe-ref.js

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@dzsodzso63 Sorry for the inactivity. Does lerna changed --include-merged-tags not work for you?

(lerna changed accepts all flags that lerna version does, as documented)

Was this page helpful?
0 / 5 - 0 ratings