Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 13 additions & 23 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
name: Publish Package to npmjs
on:
workflow_dispatch:
pull_request:
tags:
- v*.*.*
release:
types: [published]
jobs:
publish:
build:
runs-on: ubuntu-latest

name: 'publish npm'

environment: npm

steps:
- uses: actions/checkout@master

- name: Install and Build
run: |
npm install
npm run build

- name: 'Publish to the npm registry'
uses: primer/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # 跟前面步骤中的 NPM_AUTH_TOKEN 保持一致
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
default_branch: 'main'
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}