From e4c08e2fb6c6ebcafbdc2cc113acf691eabbdcac Mon Sep 17 00:00:00 2001 From: microshine Date: Tue, 16 Jan 2024 22:43:03 +0100 Subject: [PATCH] ci: update publish action --- .github/workflows/publish.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c60a68d..fafeacd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,16 +11,31 @@ jobs: - uses: actions/setup-node@v4 with: node-version: '20.x' + + - name: Setup .npmrc + shell: bash + run: | + npm set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN + env: + NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} + + - name: Ensure access + shell: bash + run: npm whoami --registry https://registry.npmjs.org/ + env: + NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} + - name: Install dependencies run: npm install + - name: Build run: npm run build + - name: Publish to NPM - run: | - npm set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN - npm publish --access public + run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} + - name: Create Release id: create_release uses: actions/create-release@v1