-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Unable to publish to Github unless I append username to front #1108
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
Comments
An update, hopefully you may have alternative ideas. I assumed by using Then I attempted So that leaves the options to simply re-name the package, or before running - name: Find and Replace
uses: jacobtomlinson/gha-find-replace@v3
with:
find: '"name": "node-toasted"'
replace: '"name": "@aetherinox/node-toasted"'
include: "package.json"
regex: true Then the package publishes successfully. Am I missing what the scope parameter is actually for? |
Hello @Aetherinox, |
Appreciate it. Sorry if the post is all over the place. I spent 3 hours testing every little aspect I thought could possibly fix it. Pretty much everything I tried failed to publish the package, unless I actually edit my
to:
|
Hello @Aetherinox, Here’s a clearer breakdown:
In npm, the package name in the The behavior you're seeing with the GitHub Packages only supports scoped npm packages, which have names in the format of The workaround you found is the best solution. You can use a script or workflow step to conditionally modify the package name in I hope this information helps clarify the situation. If you have further questions or issues, please feel free to share. |
Thanks for the clarification. One more question. Github is using @scope for package names. The day I was looking into this, I read something somewhere that npmjs was debating on also using scopes, and the developer admits that it was a dumb idea to how use scopes before. Do you know if this is being pushed on nomjs as well? I couldn't find any further information on it after I found that initial article. Because the issue is, unless I add a workflow step in to modify the package.json to automatically add the scope, that means on npmjs I have one without a scope, and then on Github, I have one with the scope added. |
@Aetherinox, However, the requirement to use scoped packages is specific to To ensure consistency across I hope this provides the clarity. |
Nice, appreciate this. The work-around via workflow seems to do good for now. At least I have a better understanding of the whole scoped situation. Thanks for the insight. |
Description:
Workflow scope not being detected / defaults to npm when attempting to upload to both npmjs.com and Github.
Action version:
v4
Platform:
Runner type:
Tools version:
Repro steps:
Expected behavior:
Worker should publish to both npmjs and github with the same workflow.
Actual behavior:
Created a single github workflow, it publishes to Github and npmjs
In the example above, I've provided the
scope
, as well as the Github npm repo. However, when actually running the workflow, I get:What I've noticed is that I can get Github to successfully publish my package, but I must modify my package name itself. If I change the package name to:
It works fine, however, if I use
I get the error listed above. And after searching this git repo issue section; I've noticed quite a few are getting it, but no definitive solution. I've ensured my tokens are right, and they are. As soon as I switch the package name to include @username, then it publishes fine.
Obviously this could be a solution, but I'd prefer my packages don't start with my username on npmjs, otherwise it makes searching more complicated.
I was assuming
scope
is what would allow for a package name, without the need for the username at the beginning.Here is one of the failed runs:
And here is the successful run:
For now I've removed the npmjs publish code until I can figure out how to publish to github without the name being appended to the front.
Here is the workflow file:
A little messy with now until I get this figured out.
I did however, review the logs from the workflow, and saw this, which doesn't make sense. If it's seeing that scope, why the package name change:
Also tried both scopes:
And I tried printing
/home/runner/work/_temp/.npmrc
:Been reading around, and someone posted using
during the build process, however, it seems to cut off part of the name
name: 'node-toasted'
becomesname: '@aetherinox/toasted'
The text was updated successfully, but these errors were encountered: