-
Notifications
You must be signed in to change notification settings - Fork 4
44 lines (34 loc) · 1.12 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Publish to NPM Registry
on:
release:
types:
- created
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1
ref: ${{ github.event.release.tag_name}}
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 18 # 你可以选择所需的 Node.js 版本
- name: Use Pnpm
uses: pnpm/action-setup@v2
with:
version: ${{ vars.PNPM_7_VERSION }}
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build package
run: pnpm build # 如果你的项目需要构建过程,请确保你有一个 "build" script 在 package.json 中
- name: Test package
run: pnpm test # 确保你的项目有一个 "test" script 在 package.json 中
- name: set token
run: echo -e //registry.npmjs.org/:_authToken=${NPM_TOKEN} >> .npmrc
env:
NPM_TOKEN: ${{ secrets.SHINED_NPM_PUBLISH_TOKEN }}
- name: Publish package
run: pnpm release