-
Hi! I have Node.js project and I want to publish it to npm registry when I create a new release on GitHub. But when I try to do it with yarn, I’ve got this error: No token found and can’t prompt for login when running with --non-interactive. So I tried to do it with npm, but again error: “Unauthorized”. And another thing: how can it now the next version? Can I somehow get it from GitHub release? I know I can updated it to next fix version, but what if I want to do minor / major update? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If anyone would ancounter the same problem, here is the solution: In $GITHUB_REF env variable is reference to the release version in format “refs/tags/<tag>”. You can remove the prefix and pass the version to publish command:
It will publish the new version, but still ends with error. It is because it tries to also create a commit, but git needs your name and email to do it.
You can either set the user email and name before the command or you can add --no-git-tag-version parameter for yarn publish command. The final publish command then looks like this:
|
Beta Was this translation helpful? Give feedback.
If anyone would ancounter the same problem, here is the solution:
In $GITHUB_REF env variable is reference to the release version in format “refs/tags/<tag>”. You can remove the prefix and pass the version to publish command:
It will publish the new version, but still ends with error. It is because it tries to also create a commit, but git needs your name and email to do it.