Auto: Master build will attempt to publish the previous version.

Created on 24 Feb 2020  Â·  18Comments  Â·  Source: intuit/auto

Describe the bug

npm version never increments between master builds.
After a successful publish to npm, if I merge a new PR that doesn't manually bump the version in package.json the shipit command will attempt to publish the previous version again which fails with -

npm ERR! 403 403 Forbidden - PUT https://registry.yarnpkg.com/@kenshooui%2freact-tree - You cannot publish over the previously published versions: 0.0.16.
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy.

To Reproduce

  1. Got an npm package that is published independently inside a monorepo.
    package.json has a version set to 1.1 for example which is already published.

  2. I issue a new PR and when I merge it shipit attempts to publish 1.1 again.

  3. (*) When a new tag is generated, using the TravisCI documentation you provided, it will release a canary version of the package.

Expected behavior

I'd expect shipit to publish 1.1.1 and/or update the package.json version.

Environment information:

Environment Information:

"auto" version: v9.13.0
"git"  version: v2.22.0
"node" version: v12.14.1

Project Information:

✔ Repository:      kenshoo/react-tree (​https://github.com/kenshoo/react-tree​)
✔ Author Name:     Lior
✔ Author Email:    [email protected]
✔ Current Version: v0.0.15
✔ Latest Release:  v0.0.16 (​https://github.com/kenshoo/react-tree/releases/tag/v0.0.16​)

✔ Labels configured on GitHub project 

GitHub Token Information:

✔ Token:            [Token starting with c5f0]
✔ Repo Permission:  admin
✔ User:             uikenshoo
✔ API:              https://api.github.com (​https://api.github.com​)
✔ Enabled Scopes:   repo, read:org, user:email, repo_deployment, repo:status, write:repo_hook, write:packages, read:packages
✔ Rate Limit:       4974/5000

Additional context

The project is empty and public so auto, travis.yml and the travis build are all visible.
I'm sure it's something wrong that I'm doing but I'd appreciate any pointer.

Please note that while the project is a monorepo, I'm using auto on a single package.

bug

All 18 comments

Please note that while the project is a monorepo, I'm using auto on a single package.

Without reading into this too much I think this is the problem. If you're using lerna it will try to publish with lerna instaed of npm. Looking into this more now though

Can you link me to that build?

I'm not using Lerna but yarn workspaces and preconstruct.
This is the build -
https://travis-ci.org/kenshoo/react-tree/builds/654544555?utm_source=github_status&utm_medium=notification

I'm getting a PR together that should set this up correctly. Currently with the npm plugin lerna is a required peer dep for publishing. I'll set this up for you too.

In the future this may not be the case with #917. But that could be a ways off because I want to keep auto stable for a while.

Thanks, I appreciate your above and beyond assistance!
I'll let you know if that helped.

Damn that didn't work. Seems to be a git issue now though. We had docs to checkout master but i though that wasn't needed anymore.

Seems like you might need to checkout a branch before running shipit on master

https://github.com/intuit/auto/commit/f64d39e1f33bd8abe7c5225efc77fbc5fb1b808c#diff-fae94f6c969367129f745870a97c116f

Interesting, I'll do some reading but won't that break the canary release?

I would only do that on master. All other types of releases do not require the ability to commit.

deploy:
  - provider: script
    script: if [ "$NPM_TOKEN" != "false" ];then 
        if [ "$TRAVIS_BRANCH" == "master" ];then 
          git checkout master;
        fi;

        yarn release;
      fi;
    skip-cleanup: true
    on:
      all_branches: true

I'm contemplating whether the npm+lerna plugin should just do this itself

EDIT: I dont think I want to. since do this automatically might break some other behavior and this is very dependent on build platform. I'm just gonna add some docs around it

Sorry if this is getting a bit out of scope but it looks like the change also broke the PR build.
For some reason it's not using the NPM_TOKEN now.
https://travis-ci.org/kenshoo/react-tree/builds/654591331#L303

Any chance it's not generating npmrc properly?

I think I wrote the yml incorrectly sh: 1: [: checkout-master-on-release: unexpected operator

We can update this PR with your findings: https://github.com/intuit/auto/pull/990/files

Looks like the final change got it to work
https://github.com/kenshoo/react-tree/blob/master/.travis.yml is the final version.
Like I mentioned, I had to add some more logic to the branch check.

Thanks so much for the help!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zephraph picture zephraph  Â·  10Comments

bbrinx picture bbrinx  Â·  8Comments

zephraph picture zephraph  Â·  12Comments

aleclarson picture aleclarson  Â·  9Comments

jdalrymple picture jdalrymple  Â·  6Comments