-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
registry-url config option Ignored when pushing to GPR and NPR #73
Comments
Having the same issue publishing to our org GitHub npm registry |
same here |
Hi all - here is a workflow that publishes to both NPMJS and GPR, without needing .npmrc workarounds: Just replace Is working at https://github.com/affrae/fib-tools name: Publish to NPMJS and GPR
on:
push:
branches:
- master
jobs:
publish-to-npm-and-gpr:
runs-on: ubuntu-latest
steps:
# Checkout the repo
- uses: actions/checkout@master
# Update package version and set up git
- uses: actions/setup-node@master
- name: Update package version and setup git
run: |
git config user.name "Actions User"
git config user.email noreply@github.com
npm version 1.0.$(date +%s)
# Publish to NPMJS
- uses: actions/setup-node@master
with:
node-version: 12
registry-url: 'https://registry.npmjs.org/'
- name: Publish to NPMJS
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm config set scope "<@OWNER>"
npm config list
npm publish --access public
env:
CI: true
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
# Publish to GitHub Package Registry
- uses: actions/setup-node@master
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
scope: '<@OWNER>'
- name: Publish to GitHub Package Registry
run: npm publish
env:
NODE_AUTH_TOKEN: ${{github.token}} |
@phillmac If you are referring to the publish to GPR section, try: # Publish to GitHub Package Registry
- uses: actions/setup-node@master
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
scope: '@phillmac'
- name: Publish to GitHub Package Registry
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} You seem to have combined the steps for publishing to Hope this helps. |
@affrae |
@phillmac I just made mine mirror yours (except for my custom info) and it worked - are you sure that the build that is running has that yml in it? or is it running another version? |
I directly linked so its pretty hard to tell fibs. |
I was not assuming you were fibbing 😜 Unless I am missing something fundamental, the only thing I can see different is the branch you are running from. let me try and replicate that when I get a chance. |
@phillmac I just noticed something:
Should be
Still gonna test |
@affrae Changed it, still no dice. It doesn't matter what token I use when its still pushing to entirely the wrong registry: i.e. NPM instead of GitHub |
@phillmac I have a working version: Config: https://github.com/affrae/fib-tools/blob/develop/.github/workflows/DevPublishToGPR.yml name: Publish develop versions to GPR
on:
push:
branches:
- develop
jobs:
publish-develop-versions-to-gpr:
runs-on: ubuntu-latest
steps:
# Checkout the repo
- uses: actions/checkout@master
# Update package version and set up git
- uses: actions/setup-node@master
- name: Update package version and setup git
run: |
git config user.name "Actions User"
git config user.email noreply@github.com
npm version 0.1.1-dev.$(date +%s)
# Publish to GitHub Package Registry
- uses: actions/setup-node@master
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
scope: '@affrae'
- name: Publish to GitHub Package Registry
run: npm publish
env:
NODE_AUTH_TOKEN: ${{github.token}} The only difference is my scope and the change to Can you check yours v. mine to see if we line up? |
So just made a commit with that copied and pasted exactly, the only difference being the username in the scope. |
@phillmac you're missing the set scope. This has to do with how Here's what should work: publish-gpr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: 12
registry-url: https://npm.pkg.github.com/ORG_OR_USERNAME/
scope: '@ORG_OR_USERNAME'
always-auth: true # required if using yarn
- name: npm install
run: npm install
- name: Publish to GitHub Packages
run: |
npm config set scope "@ORG_OR_USERNAME"
npm publish
env:
NODE_AUTH_TOKEN: ${{github.token}} The Also your package MUST be named |
Thanks @clarkbw - I wonder why I don't run into that in my workflow shared in #73 (comment).. Is it because I set the scope for an earlier step and it just carries over? |
Good question, I’m not sure. I’ll have to play around with that some more. |
Default template from GitHub Marketplace doesn't work for me too. https://github.com/avdeev/vanilla-sharing/runs/323109179 |
I also encountered the same bug.. https://github.com/SachinShekhar/ss-ngrx-router-store/runs/438107309?check_suite_focus=true This thread is 4 months old. Is GitHub Actions team aware of this issue? |
@clarkbw why specify the proxy url when you're also providing scope? (And even if you don't provide scope, setup-node will add it anyway.)
|
Just use this action to provide node. Where your package publishes to is controlled by package.json’s publishConfig. The scope should be set in the package.json’s name field. For installing packages from non-default registries... just create a step before install: - name: npm config
run: |
npm config set loglevel error
npm config set progress false
npm config set registry 'https://npm.pkg.githubs.com’
npm config set '@myscope:registry' 'https://www.myscopes-npm.com' |
@phillmac you may need to add your scope to the package name in Don't ask me why npm defaults to |
Fix publishing to GitHub Packages Registry. (see actions/setup-node#73)
* Update npm-publish.yml Fix publishing to GitHub Packages Registry. (see actions/setup-node#73) * Update package.json * Update package-lock.json
Edit: Updated to reduce noise, see below for my fix. I've previously been doing releases from my PC, trying to migrate over to actions. Now when I do a release, it releases to NPM fine - but not GPR, giving the login error:
|
@lukesrw Observations: You can't publish to Writing to I have a working example of GPR publish at https://github.com/joebowbeer/regsync I'd need to see more of package.json to debug further. What are the |
But that's why I was so confused, as I was doing previously.
Ah, that makes sense! Thank you, that's fixed the problem - it's publishing to both now. For anyone else having this problem, my workaround:
I'm sure that some of these lines aren't needed, but for now my yml is:
Make sure you've got an NPM_TOKEN secret setup, change the echo line to have your name instead of mine - and it should work. |
fixed pipeline to push to github registry as well as npm registry 3.1.2 fixed issue with ghr due to it not knowing of which registry to use: actions/setup-node#73
fixed pipeline to push to github registry as well as npm registry 3.1.2 fixed issue with ghr due to it not knowing of which registry to use: actions/setup-node#73
fixed pipeline to push to github registry as well as npm registry 3.1.2 fixed issue with ghr due to it not knowing of which registry to use: actions/setup-node#73
fixed pipeline to push to github registry as well as npm registry 3.1.2 fixed issue with ghr due to it not knowing of which registry to use: actions/setup-node#73 clean up pipeline with tagging and publish 3.1.3
@joebowbeer, it seems it is not necessary to set the |
@xeptore Thanks. I agree. I just updated |
This is a known issue: actions/setup-node#73
I'm unable to get this to work without adding a scope to the package name – something I'm unable to do since the Visual Studio Marketplace does not support scopes. I would consider it a pretty serious bug that the |
- Add publish-vsce job to publish the extension to the Visual Studio Code Extension Marketplace. - Remove the `@remarkjs` scope since VSCE doesn't like it. - Use manual `npm config` instead of `actions/setup-node@v2` since the latter only seems to work with scoped packages (see actions/setup-node#73).
- Add publish-vsce job to publish the extension to the Visual Studio Code Extension Marketplace. - Remove the `@remarkjs` scope since VSCE doesn't like it. - Use manual `npm config` instead of `actions/setup-node@v2` since the latter only seems to work with scoped packages (see actions/setup-node#73).
- Add publish-vsce job to publish the extension to the Visual Studio Code Extension Marketplace. - Remove the `@remarkjs` scope since VSCE doesn't like it. - Use manual `npm config` instead of `actions/setup-node@v2` since the latter only seems to work with scoped packages (see actions/setup-node#73).
- Add publish-vsce job to publish the extension to the Visual Studio Code Extension Marketplace. - Remove the `@remarkjs` scope since VSCE doesn't like it. - Use manual `npm config` instead of `actions/setup-node@v2` since the latter only seems to work with scoped packages (see actions/setup-node#73).
- Add publish-vsce job to publish the extension to the Visual Studio Code Extension Marketplace. - Remove the `@remarkjs` scope since VSCE doesn't like it. - Add .npmrc instead of `actions/setup-node@v2` since the latter only seems to work with scoped packages (see actions/setup-node#73).
From #53 (comment) I discovered that the GitHub Package Registry documentation explicitly states that GPR only supports scoped packages:
Pretty horrific, if you ask me. |
@asbjornu see 2nd section of #73 (comment) |
@joebowbeer, yes it works with scoped packages ( |
@asbjornu GPR only hosts scoped packages. Agreed. That is very clear in the GPR documents. However, you can omit the scope from package.json for backward compatibility with the npm registry. |
…and still publish the package to GPR? I have not gotten this to work. I'm stuck with either this error message:
Or this:
|
@asbjornu see #73 (comment) for a working example. The Unauthorized error is probably due to a missing
I suggest you create a new issue and include a link to your repo with package.json, .npmrc, and your GH action. |
No, the |
Add registry workaround from actions/setup-node#73 (comment)
Hello everyone. I'm going to close the issue. According to the thread initial issues were resolved from customer's side and other separate issues were created. If you still have some issue feel free to create a new one. |
Add github actions for code checks
Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 8.10.2 to 9.0.0. - [Release notes](https://github.com/TypeStrong/ts-node/releases) - [Commits](TypeStrong/ts-node@v8.10.2...v9.0.0) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Registry url seems to be ignored here https://github.com/phillmac/orbit-db-managers/blob/a50a35fca7b0d1b79871428b39deb8ecb1293edf/.github/workflows/npmpublish.yml#L40
This differs from #52 in that there's no
.npmrc
present in the repo.It results in an error in the GPR publish step:
npm ERR! 401 Unauthorized - PUT https://registry.npmjs.org/orbit-db-managers - You must be logged in to publish packages.
The text was updated successfully, but these errors were encountered: