-
Notifications
You must be signed in to change notification settings - Fork 7
52 lines (46 loc) · 1.33 KB
/
npmPublish.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
name: npm publish
on:
push:
branches:
- master
jobs:
publish-npm:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
# from: https://github.com/actions/checkout
- name: 1. 检查master分支
uses: actions/checkout@master
# from: https://github.com/actions/setup-node
- name: 2. 设置Node.js
uses: actions/setup-node@master
with:
node-version: ${{ matrix.node-version }}
# from: https://github.com/actions/cache
- name: 3. 缓存
uses: actions/cache@v2
id: cache-dependencies
with:
path: node_modules
key: ${{runner.OS}}-${{hashFiles('**/yarn.lock')}}
- name: 4. 安装插件
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
export TZ='Asia/Shanghai'
yarn install
- name: 5. 生成文件
run: |
export TZ='Asia/Shanghai'
yarn run build
cp package.json ./dist/package.json
cp ./dist/ispeak.umd.js ./dist/ispeak.min.js
cp ./dist/style.css ./dist/ispeak.min.css
- name: 6. 发布包
run: |
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
cd dist
npm publish
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}