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

Allow "version" and "publish" to ignore checks for version tag #1610

Closed
ctran opened this issue Aug 27, 2018 · 6 comments
Closed

Allow "version" and "publish" to ignore checks for version tag #1610

ctran opened this issue Aug 27, 2018 · 6 comments

Comments

@ctran
Copy link

ctran commented Aug 27, 2018

I was using the beta version (3.0.0-beta.21) which works well with our release process (maven):

  • We update versions of various artifacts (we have our own artifacts to attach additional metadata)
  • Run "lerna publish --repo-version=$npm_package_version --skip-git --skip-npm" to update versions
  • We commit all changed files and tag (using our convention)
  • Run "lerna publish --repo-version=$npm_package_version --skip-git" again to publish the npm packages

The latest version 3.0.14 has added a bunch of checks which makes it impossible for us to integrate with our release process.

I tried lots of combinations of "version" and "publish" but can't seem to pass the following problems:

  1. "lerna version $npm_package_version --force-publish=* --no-git-tag-version" doesn't work if there's no tag
  2. "lerna publish from-git" doesn't work because it doesn't find the version tag either
  3. "lerna publish ..." doesn't work because of the problem 1

If there's a way to do above, I'd be very happy :-)

@evocateur
Copy link
Member

If your convention is so dramatically different than lerna's (which is the convention used by 98% of the hundreds of thousands of packages in the npm registry), I'm afraid Lerna isn't going to work very well for you.

In any case, without error messages or isolated reproductions, I can't suggest alternatives.

@joebowbeer
Copy link

I would also like to see more support for --no-git-tag-version.

I think it is a sufficiently-common workflow with npm packages published by CI/CD to have the devs bump the version on a branch (using --no-git-tag-version), submit a PR, squash merge to master after approval, and then have the CI/CD publish the new version to the npm registry.

A quick search for npm publish CI returns a few articles outlining the process, and the npm version and npm publish implementations (and separation of concerns) makes this possible. It is not the most common workflow by far, but it is common enough.

With lerna, the new version command is a step in the right direction (thanks!), and I agree that the use of file specifiers instead of bootstrap is a win, but as things are now, lerna version --no-git-tag-version seems to be of limited use because npm publish will balk without git tags.

After running lerna version patch --no-git-tag-version and committing and pushing the changes, what command can be used to publish these changes?

Does npm publish need a from-package option in addition to a from-git option?

@shawnbot
Copy link
Contributor

Our use case is exactly the one described above, and I've been having a hell of a time figuring out how to get canary releases working after upgrading to Lerna v3 from v2. All of the tags that I assume Lerna wants are in git, but lerna publish --canary still bails, claiming that there are no git tags. Using --force-publish tries to compare the same commit SHA and comes up with no changes.

I think the from-package positional described in #1648 would fix this, but I feel like I'm missing something else. Is there something that I should have done when migrating from v2 to v3?

@evocateur
Copy link
Member

v3.3.2 allows you to use --force-publish effectively with lerna publish --canary. It's not a perfect solution for the automated CI publish scenario, however.

@ctran
Copy link
Author

ctran commented Oct 26, 2018

For those struggling with similar problem (private registry and needs to separate the versioning and publishing), You can use the following workaround:

  • Use lerna v3.4.1
  • Ping @lerna/publish to v3.2.2
  • Run lerna version $rev --no-push --no-git-tag-version --yes ... to update desired package versions
  • Commit files and any other git operations (i.e tag and push)
  • Create annotated tag localy git tag -a -m $rev $rev
  • Then publish packages via lerna publish from-git --no-verify-access --no-verify-registry --yes

@ctran ctran closed this as completed Oct 26, 2018
@lock
Copy link

lock bot commented Dec 27, 2018

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants