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

failure in setting npm config in shipjs trigger #931

Closed
vinayakkulkarni opened this issue Oct 6, 2020 · 7 comments · Fixed by vinayakkulkarni/v-mapbox#152
Closed

failure in setting npm config in shipjs trigger #931

vinayakkulkarni opened this issue Oct 6, 2020 · 7 comments · Fixed by vinayakkulkarni/v-mapbox#152

Comments

@vinayakkulkarni
Copy link
Contributor

Describe the bug
npx shipjs trigger doesn't work

To Reproduce
Steps to reproduce the behavior:

  1. https://github.com/geospoc/v-mapbox/runs/1212948942
    Check the workflow details, you'll see

Expected behavior
Ideally, ship.js trigger should publish the pkg to registry, but it doesn't automatically publish to the registry.

Screenshots
Screenshot 2020-10-06 at 7 15 41 PM

Environment (please complete the following information):

  • environment: GitHub actions
  • node -v: 10.22.1
  • npm -v or yarn -v: 6.14.6
  • Ship.js version: 0.22.0

Additional context
NA

@eunjae-lee
Copy link
Contributor

Thanks @vinayakkulkarni for reporting the issue.

Hey @jeetiss if I remember correctly, you have dealt with an issue regarding NPM_AUTH_TOKEN before, right?
This bug is coming from my recent change. Do you have any idea what is wrong here?
If not, let me know. I will keep investigating the issue.

@KnisterPeter
Copy link

Happened for me as well. I would say, the first issue here is, that the release is marked as success but the process failed.
The release trigger should defnitly fail.

@eunjae-lee
Copy link
Contributor

Oh actually this seems to be fixed in #928
Can you replace

NODE_AUTH_TOKEN: \${{ secrets.NPM_AUTH_TOKEN }}

with

NPM_AUTH_TOKEN: \${{ secrets.NPM_AUTH_TOKEN }}

in your workflow file?

@vinayakkulkarni @KnisterPeter

Please let me know if it fixes your issue.

@KnisterPeter
Copy link

@eunjae-lee Thanks, I'll report back when I do the next release.

@KnisterPeter
Copy link

Works fine. You close this one. 🎉

@eunjae-lee
Copy link
Contributor

@KnisterPeter thanks for the confirmation 👍

@vinayakkulkarni this will fix your issue!

@vinayakkulkarni
Copy link
Contributor Author

Oh FYI, if anyone is facing an issue while publishing to GPR, here's a sample Shipjs trigger .yml:

name: Ship js trigger
on:
  pull_request:
    types:
      - closed
jobs:
  build:
    name: Release
    runs-on: ubuntu-latest
    if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/v')
    steps:
      - name: Checkout code 🛎
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
          ref: main

      - name: Setup node env 🏗
        uses: actions/setup-node@v2.1.4
        with:
          node-version: 14
          registry-url: 'https://npm.pkg.github.com'
          scope: '<@scope>'

      - name: Install dependencies 👨🏻‍💻
        run: npm ci
        env:
          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Release pkg to registry ⚡️
        run: npx shipjs trigger
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }}

Apparently, NODE_AUTH_TOKEN is required for npm publish
Ref: actions/setup-node#52 (comment)

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

Successfully merging a pull request may close this issue.

3 participants