-
Notifications
You must be signed in to change notification settings - Fork 9
56 lines (48 loc) · 1.27 KB
/
publish.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
45
46
47
48
49
50
51
52
53
54
55
56
name: Release
on:
push:
tags:
- 'v*'
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body_path: ${{ github.workspace }}/CHANGELOG.md
draft: false
prerelease: false
publish-npm:
name: Publish to NPM
runs-on: ubuntu-latest
# Skip this step in forks
if: ${{ github.repository_owner == 'ZhongxuYang' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 21
# 安装 pnpm
- uses: pnpm/action-setup@v4
with:
version: 8
- name: Install dependencies
run: pnpm install && pnpm build
- name: Publish packages to NPM
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
npm whoami
npm publish