-
Notifications
You must be signed in to change notification settings - Fork 91
77 lines (63 loc) · 1.96 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: 🎉 Release
on:
push:
tags:
- 'v*'
workflow_dispatch: # 允许手动触发,并可以指定分支
inputs:
branch:
description: 'Branch to release from'
required: true
default: 'main' # 默认使用 main 分支
type: string
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v2
- name: Set node
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: pnpm
- name: Install
run: pnpm install --no-frozen-lockfile
- name: Set Timezone
run: |
sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo "Asia/Shanghai" | sudo tee /etc/timezone
date
shell: bash
- name: Build
run: pnpm run build
- name: unit test
run: pnpm run test:unit
- name: Set npmrc for components
run: |
for package in $(find components/* -maxdepth 1 -type d); do
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ${package}/.npmrc
done
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Set npmrc for root preset
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > preset/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Set npmrc for root utils
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > utils/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Set npmrc for root packages
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish to npm
run: pnpm run publish:script
- run: npx changelogithub
continue-on-error: true
env:
GITHUB_TOKEN: ${{secrets.GH_TOKEN}}