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

yarn publish attempts to create multiple identical git tags during lerna publish --canary #1662

Closed
ctaepper opened this issue Sep 7, 2018 · 5 comments · Fixed by JetBrains/ring-ui#404

Comments

@ctaepper
Copy link

ctaepper commented Sep 7, 2018

after upgrading to lerna v3 I can't seem to get canary release to work anymore, not on CI, also not local.

Edit: I'm executing the following:

lerna publish --canary --npm-tag=next --yes --no-verify-access

looking at the console output, it seems like lerna...

  1. publishes the first package
  2. tags the local repo with the release version
  3. publishes the second package
  4. trys to tag the repo again with the same tag and fails
  5. immediatly aborts the whole process

I'm left with

  • a finished release of the first package
  • a leftover tarball in the folder of the second package
  • a leftover tarball in the folder of the third package and a modified package.json pointing to the canary release of the first package

Help!

I also tried to add the --no-git-tag-version flag, so i would assume lerna does not try to tag the repo, but it doesn't seem to have any effect

lerna.json

{
  "packages": [
    "packages/*"
  ],
  "version": "3.7.1",
  "concurrency": 1,
  "npmClient": "yarn",
  "useWorkspaces": true,
  "stream": true,
  "exact": true,
  "conventionalCommits": true,
  "command": {
    "publish": {
      "message": "chore(release): publish %s"
    }
  }
}

console output

➜  project git:(develop) npx lerna publish --canary minor --npm-tag=next 
lerna notice cli v3.3.0
lerna info canary enabled
lerna info Looking for changed packages since 11d56dee^..11d56dee

Found 3 packages to publish:
 - @mytag/mock-server => 3.8.0-alpha.5+11d56dee
 - @mytag/server => 3.8.0-alpha.5+11d56dee
 - @mytag/web => 3.8.0-alpha.5+11d56dee

? Are you sure you want to publish these packages? Yes
lerna info publish Publishing packages to npm...
mytag-web-3.8.0-alpha.5.tgz
lerna notice 
lerna notice 📦  @mytag/web@3.8.0-alpha.5+11d56dee
lerna notice === Tarball Details === 
lerna notice name:     @mytag/web                 
lerna notice version:  3.8.0-alpha.5+11d56dee   
lerna notice filename: mytag-web-3.8.0-alpha.5.tgz
lerna notice 
mytag-mock-server-3.8.0-alpha.5.tgz
mytag-server-3.8.0-alpha.5.tgz
lerna notice 
lerna notice 📦  @mytag/mock-server@3.8.0-alpha.5+11d56dee
lerna notice === Tarball Details === 
lerna notice name:     @mytag/mock-server                 
lerna notice version:  3.8.0-alpha.5+11d56dee           
lerna notice filename: mytag-mock-server-3.8.0-alpha.5.tgz
lerna notice 
lerna notice 
lerna notice 📦  @mytag/server@3.8.0-alpha.5+11d56dee
lerna notice === Tarball Details === 
lerna notice name:     @mytag/server                 
lerna notice version:  3.8.0-alpha.5+11d56dee      
lerna notice filename: mytag-server-3.8.0-alpha.5.tgz
lerna notice 
lerna info published @mytag/web 3.8.0-alpha.5+11d56dee
lerna ERR! yarn publish --ignore-scripts --tag next --new-version 3.8.0-alpha.5+11d56dee --non-interactive mytag-mock-server-3.8.0-alpha.5.tgz exited 1 in '@mytag/mock-server'
lerna ERR! yarn publish --ignore-scripts --tag next --new-version 3.8.0-alpha.5+11d56dee --non-interactive mytag-mock-server-3.8.0-alpha.5.tgz stdout:
yarn publish v1.7.0
[1/4] Bumping version...
info Current version: 3.8.0-alpha.5
info New version: 3.8.0-alpha.5+11d56dee
[2/4] Logging in...
[3/4] Publishing...
info Visit https://yarnpkg.com/en/docs/cli/publish for documentation about this command.

lerna ERR! yarn publish --ignore-scripts --tag next --new-version 3.8.0-alpha.5+11d56dee --non-interactive mytag-mock-server-3.8.0-alpha.5.tgz stderr:
error Command failed.
Exit code: 128
Command: git
Arguments: tag v3.8.0-alpha.5+11d56dee -am v3.8.0-alpha.5+11d56dee
Directory: /Users/ct/tresmo/project
Output:
fatal: tag 'v3.8.0-alpha.5+11d56dee' already exists

lerna ERR! yarn publish --ignore-scripts --tag next --new-version 3.8.0-alpha.5+11d56dee --non-interactive mytag-mock-server-3.8.0-alpha.5.tgz exited 1 in '@mytag/mock-server'

Context

trying to get the per-commit canary release to work again

Your Environment

Executable Version
lerna --version 3.3.0
npm --version 5.6.0
yarn --version 1.7.0
node --version 8.11.1
OS Version
macOS High Sierra 10.13.6
@ctaepper
Copy link
Author

I now reverted back to lerna 2.11.0, everything ist working again. To sum up: publishing canary definitly behaves very differently in v3 if not unusable

@evocateur evocateur added the yarn label Sep 11, 2018
@evocateur
Copy link
Member

It appears to be yarn "helpfully" making the git tag call, as Lerna most definitely does not attempt to create git tags during a --canary publish. To workaround it, configure npm as your command.publish.npmClient.

As for properly fixing it, I guess we need to read the yarn source to figure out which inscrutable CLI option is required to disable this "helpful" tagging. Or just revert to always using npm to publish, which is really what I'd rather do, for a whole bunch of reasons...

@evocateur evocateur changed the title publish canary trys to tag the repo multiple times after update to lerna v3 yarn publish attempts to create multiple identical git tags during lerna publish --canary Sep 11, 2018
@evocateur
Copy link
Member

I found it: https://github.com/yarnpkg/yarn/blob/eb2b565bb9b948e87b11119482ebc184a9d66141/src/cli/commands/version.js#L149

Passing --no-git-tag-version to yarn publish should fix this.

@ctaepper
Copy link
Author

thats great! will try that asap

@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.