Skip to content
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

Publish to a private registry authentication fails and work around #54

Closed
Dreamystify opened this issue Jun 29, 2022 · 1 comment
Closed
Labels
question Further information is requested

Comments

@Dreamystify
Copy link

I tried to get this working with no success with auth issues:

npm ERR! 401 Unauthorized - GET https://<workspace>.bytesafe.dev/r/npm/@<scope-name>%2f<package-name> - Access Denied

I require the step Setup NPMrc for JS-DevTools for the auth to work

 - name: Setup NPMrc for JS-DevTools
   run: echo "//<workspace>.bytesafe.dev/r/npm/:_authToken=${{secrets.BYTESAFE_TOKEN}}" >> .npmrc
 - id: publish
    uses: JS-DevTools/npm-publish@v1
    with:
      registry: 'https://<workspace>.bytesafe.dev/r/npm/'
      token: ${{secrets.BYTESAFE_TOKEN}}
      access: restricted
      check-version: true
  - if: steps.publish.outputs.type != 'none'
     run: |
       echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}"

Am I configuring JS-DevTools/npm-publish@v1 wrong?

@mcous mcous added the question Further information is requested label Apr 7, 2023
@mcous
Copy link
Member

mcous commented Apr 10, 2023

In your example snippet, I am assuming you are using <workspace> as a placeholder to be replaced with your actual Bytesafe subdomain.

My ideas:

  • name: Setup NPMrc for JS-DevTools
    run: echo "//.bytesafe.dev/r/npm/:_authToken=${{secrets.BYTESAFE_TOKEN}}" >> .npmrc

This above step should not be necessary when using this action

  • id: publish
    uses: JS-DevTools/npm-publish@v1
    with:
    registry: 'https://.bytesafe.dev/r/npm/'
    token: ${{secrets.BYTESAFE_TOKEN}}
    access: restricted
    check-version: true

I think you must use spaces when accessing repository secrets via ${{ ... }}. This is a GH Actions syntax thing, and not something specific to this action.

# correct
token: ${{ secrets.BYTESAFE_TOKEN }}

# incorrect
token: ${{secrets.BYTESAFE_TOKEN}}

Since this ticket is a little old and I don't see any issues in the code, I'm going to close this ticket as "cannot reproduce." Let me know if you're still experiencing issues and we can investigate and/or re-open.

@mcous mcous closed this as not planned Won't fix, can't repro, duplicate, stale Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant