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

Unable to publish package for the first time #117

Closed
abhishiv opened this issue Jul 8, 2023 · 3 comments
Closed

Unable to publish package for the first time #117

abhishiv opened this issue Jul 8, 2023 · 3 comments

Comments

@abhishiv
Copy link

abhishiv commented Jul 8, 2023

Hello,

It seems that with v2, I can't publish the package for the first time. Or am I doing something wrong?

    - id: publish
      uses: JS-DevTools/npm-publish@v2
      with:
        registry: "https://registry.npmjs.org/"
        token: ${{ inputs.dir }}
        access: "public"
        package: ./${{ inputs.dir }}/package.json
    - if: steps.publish.outputs.type != 'none'
      run: |
        echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}"
      shell: bash

Error

Warning: Unexpected input(s) 'check-version', valid inputs are ['token', 'registry', 'package', 'tag', 'access', 'provenance', 'strategy', 'ignore-scripts', 'dry-run']
Run JS-DevTools/npm-publish@v2
  
Error: NpmCallError: Call to "npm publish" exited with non-zero exit code 1
npm notice Publishing to https://registry.npmjs.org/ with tag latest and public access
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://registry.npmjs.org/@gratico%2fbanyan - Not found
npm ERR! 404 
npm ERR! 404  '@gratico/banyan@0.2.4' is not in this registry.
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/[20](https://github.com/graticohq/mono/actions/runs/5495942601/jobs/10015646386#step:8:22)23-07-08T19_01_12_153Z-debug-0.log

@abhishiv
Copy link
Author

abhishiv commented Jul 8, 2023

Also getting the same error with v1

Run graticohq/mono@v6
Run cd packages/platform/apps/banyan  && jq -s 'add'  package.json package-publish.json > package-final.json && rm -rf package.json && mv package-final.json package.json
Run JS-DevTools/npm-publish@v1
npm notice 
npm notice 📦  @gratico/banyan@0.2.4
npm notice === Tarball Contents === 
npm notice 0B    README.md                        
npm notice 278B  dist/components/Layout/index.d.ts
npm notice 82B   dist/index.d.ts                  
npm notice 1.4kB dist/index.js                    
npm notice 140B  dist/types/index.d.ts            
npm notice 258B  dist/utils/index.d.ts            
npm notice 1.2kB package.json                     
npm notice === Tarball Details === 
npm notice name:          @gratico/banyan                         
npm notice version:       0.2.4                                   
npm notice filename:      gratico-banyan-0.2.4.tgz                
npm notice package size:  1.7 kB                                  
npm notice unpacked size: 3.4 kB                                  
npm notice shasum:        84631a4548d96adba49ab76[11](https://github.com/graticohq/mono/actions/runs/5496011504/jobs/10015761474#step:8:12)fc250ed2cf181cc
npm notice integrity:     sha512-jCf/HE6ywoPyg[...]m3icrMiFfUMow==
npm notice total files:   7                                       
npm notice 
npm notice Publishing to https://registry.npmjs.org/ with tag latest and public access
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://registry.npmjs.org/@gratico%2fbanyan - Not found
npm ERR! 404 
npm ERR! 404  '@gratico/banyan@0.2.4' is not in this registry.
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2023-07-08T[19](https://github.com/graticohq/mono/actions/runs/5496011504/jobs/10015761474#step:8:21)_16_[36](https://github.com/graticohq/mono/actions/runs/5496011504/jobs/10015761474#step:8:39)_[58](https://github.com/graticohq/mono/actions/runs/5496011504/jobs/10015761474#step:8:61)1Z-debug-0.log
Error: Error: Unable to publish @gratico/banyan v0.2.4 to NPM. 
npm publish --access public exited with a status of 1.
    at Object.publish (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/src/npm.ts:112:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Object.npmPublish (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/src/npm-publish.ts:23:5)
    at main (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/src/action/index.ts:28:19)

EDIT: I'm able to publish from my desktop, but not via this action. Also tried regenerating the token. I published the first version from my desktop, but now I'm not even able to publish new version via the action.

@mcous
Copy link
Member

mcous commented Jul 8, 2023

Hi @abhishiv! I see two definite mistakes in the configuration you posted

The token input must be your npm token. Typically, one would store this in GH Actions secrets as secrets.NPM_TOKEN or secrets.NODE_AUTH_TOKEN. Instead, your configuration has this...

token: ${{ inputs.dir }}

...which is definitely wrong, and probably causing the error.

You have a second mistake, which your code isn't yet reaching due to the first error:

- if: steps.publish.outputs.type != 'none'

This condition is correct for v1 of this action but incorrect for v2. For v2, this should simply be:

- if: steps.publish.outputs.type

Please see the README file for further details, and let me know if correcting these configuration errors resolves your issue

@abhishiv
Copy link
Author

abhishiv commented Jul 8, 2023

Hey @mcous

Sorry for my silly mistakes and the false alarm! Yes, the problem was indeed with my configuration and not the action. The things you pointed out were indeed the issue and I was able to publish after fixing them!

Thank you for a very valuable action!

@abhishiv abhishiv closed this as completed Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants