From 961ae7d228d2ad0e548bdb6722f72e5568a4600a Mon Sep 17 00:00:00 2001 From: Jack Zhang Date: Wed, 29 Nov 2023 14:46:32 -0600 Subject: [PATCH] added npm auth token to unit tests --- .github/workflows/node.js.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 8414667a..a734e6be 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -18,20 +18,25 @@ jobs: if: "!contains(github.event.head_commit.message, '[skip ci]')" runs-on: ubuntu-latest + env: + NPM_AUTH_TOKEN: "${{ secrets.NPM_AUTH_TOKEN }}" + strategy: matrix: node-version: [10.x, 12.x, 14.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: # For commitlint; ideally this would only check out the feature branch's history, but # that's not currently an option. fetch-depth: ${{ github.event_name == 'push' }} - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} + - name: set up npmrc + run: echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_AUTH_TOKEN}}" > .npmrc - run: npm ci - run: npm run ci --if-present - run: npm run ci:commitlint @@ -47,7 +52,7 @@ jobs: needs: [lint] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: # Necessary to prevent the checkout action from writing credentials to .git/config, which # semantic-release attempts to use to push despite those credentials being denied the @@ -55,13 +60,15 @@ jobs: # See https://github.com/semantic-release/git/issues/196#issuecomment-601310576. persist-credentials: false - name: Use Node.js 14.x - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: 14.x + - name: set up npmrc + run: echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_AUTH_TOKEN}}" > .npmrc - run: npm ci - name: Release run: npx semantic-release -b master,2.x env: # Need to use a separate token so we can push to the protected default branch. GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_AUTH_TOKEN: "${{ secrets.NPM_AUTH_TOKEN }}"