pnpm / action-setup

Install pnpm package manager
https://github.com/marketplace/actions/setup-pnpm
MIT License
899 stars 87 forks source link

publishing in ci only causes errors #65

Closed VividLemon closed 1 year ago

VividLemon commented 1 year ago

I've been going through multiple runs of trying to get things to publish correctly. The first issue was, pnpm_git_not_unclean. I had that same issue awhile ago, and posted to pnpm core. It magically fixed itself so I close the issue. It's been a month with no issue, now it returns.

Okay, whatever, I updated some actions, and seems fine. Well, go to try to publish to npm a second time, says I'm not logged in... npm ERR! need auth This command requires you to be logged in to https://registry.npmjs.org/ Okay, why? The publish script has NODE_AUTH_TOKEN for it's npm token, and it's always worked before. The secret hasn't been changed.

Okay, lets try one of the different actions that I have, it runs the same setup actions, checkout, install pnpm, install node, cache, then publish. Completely different error. ERR_PNPM_GIT_UNKNOWN_BRANCH  The Git HEAD may not attached to any branch, but your "publish-branch" is set to "master|main".. What? Why is this different

A retry of the other action script gives it's own "this command requires you to be logged in" the other, with essentially the same scripts (though different activation steps) gives separate errors?

Now I just need some help on figuring out why none of this wants to work anymore. https://github.com/cdmoro/bootstrap-vue-3/blob/main/.github/workflows/release-main.yaml -- incorrect login error https://github.com/cdmoro/bootstrap-vue-3/blob/main/.github/workflows/npm-publish.yaml -- unknown branch error Both with the same setup. Any guidance on how to fix these issues would be great.

VividLemon commented 1 year ago

So, for the npm-publish script, it turns out action/checkout needs to be manually set to the branch. (If the release isn't to a push to a specific branch, it will checkout head instead) ie on: release: types: [created] checks out head.

That solved one issue. The second issue sounds like it's similar to https://github.com/pnpm/pnpm/issues/3141 . I will ask there instead if something has changed. It may be possible that the secret was set to expire... But if it did, I would assume a different error. But I'm going to close this and read, and ask in that issue if something has changed.