我当前的工作流程:
name: Node CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: |
npm install yarn -g
yarn
yarn test
env:
CI: true
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
我在回购秘密区域中设置了我的NPM_TOKEN
。
该令牌还在Netlify上使用,并且netlify构建过程正常工作。
运行此工作流程时,我的任何私有软件包都收到404。
我在做什么错?
找到修复程序:
写出.npmrc
作为作业的一部分,而不是依赖env变量。
name: Node CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
npm install yarn -g
yarn
yarn test
env:
CI: true