Skip to content

Commit aecb949

Browse files
authored
ci(workflows): add ui and renderless alpha pubish action (#2799)
* fix: fix all publish alpha packages action error * feat: add ui and renderless alpha pubish action
1 parent 187cc8e commit aecb949

File tree

3 files changed

+167
-1
lines changed

3 files changed

+167
-1
lines changed

.github/workflows/dispatch-all-publish-alpha.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
with:
2727
script: |
2828
const version = `${{ inputs.version }}`
29-
if(!/^\d\.\d+\.\d+/.test(vserion)) {
29+
if(!/^\d\.\d+\.\d+/.test(version)) {
3030
throw new Error('版本号格式不正确')
3131
}
3232
const publishVersion = version.slice(2)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Dispatch Renderless Theme Runtime
2+
run-name: Dispatch Renderless Theme Runtime--${{ inputs.components }}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
components:
8+
description: |
9+
输入需要打包的模块名称,多个以英文逗号分隔,
10+
例如: `theme,renderless,runtime`
11+
required: true
12+
type: string
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.sha }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
runs-on: windows-latest
20+
steps:
21+
- name: Parse Components
22+
id: parseComponents
23+
uses: actions/github-script@v6
24+
with:
25+
script: |
26+
const branchName = `${{ github.ref_name }}`
27+
const moduleName = `${{ inputs.components }}`
28+
29+
if (!moduleName.includes('theme') && !moduleName.includes('renderless') && !moduleName.includes('runtime')) {
30+
throw new Error('请输入正确的包名称')
31+
}
32+
33+
if (!branchName.includes('release-3.')) {
34+
throw new Error('请使用release-3.xx.xx分支发布正式包')
35+
}
36+
37+
- name: CheckOut Code
38+
uses: actions/checkout@master
39+
with:
40+
ref: ${{ github.ref_name }}
41+
42+
- name: Setup pnpm
43+
uses: pnpm/action-setup@v2
44+
45+
- name: Setup Node
46+
uses: actions/setup-node@v3
47+
with:
48+
node-version: 20.10.0
49+
registry-url: 'https://registry.npmjs.org'
50+
51+
- name: Get pnpm store directory
52+
id: pnpm-cache
53+
run: |
54+
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
55+
56+
- uses: actions/cache@v3
57+
name: Setup pnpm cache
58+
with:
59+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
60+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
61+
restore-keys: |
62+
${{ runner.os }}-pnpm-store-
63+
64+
- name: Install dependencies
65+
run: pnpm i --no-frozen-lockfile
66+
67+
- name: Run Build Theme
68+
if: contains(inputs.components, 'theme') == true
69+
run: pnpm build:theme
70+
71+
- name: Run Build Renderless
72+
if: contains(inputs.components, 'renderless') == true
73+
run: pnpm build:renderless
74+
75+
- name: Run Build ThemeSaas
76+
if: contains(inputs.components, 'theme-saas') == true
77+
run: pnpm build:themeSaas
78+
79+
- name: Run Build ThemeMobile
80+
if: contains(inputs.components, 'theme-mobile') == true
81+
run: pnpm build:themeMobile
82+
83+
- name: Run Build Runtime
84+
if: contains(inputs.components, 'runtime') == true
85+
run: pnpm build:runtime
86+
87+
- name: Run Release alpha
88+
run: pnpm release:alpha
89+
90+
- name: Publish
91+
run: |
92+
pnpm pub:all
93+
env:
94+
NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Dispatch Ui Publish
2+
run-name: Dispatch Ui--${{ inputs.components }}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
components:
8+
description: |
9+
输入需要打包的组件名称,多个以空格分隔,
10+
例如: `input alert`.
11+
required: true
12+
type: string
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.sha }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
runs-on: windows-latest
20+
steps:
21+
- name: Parse Components
22+
id: parseComponents
23+
uses: actions/github-script@v6
24+
with:
25+
script: |
26+
const branchName = `${{ github.ref_name }}`
27+
28+
if (!branchName.includes('release-3.')) {
29+
throw new Error('请使用release-3.xx.xx分支发布正式包')
30+
}
31+
32+
- name: CheckOut Code
33+
uses: actions/checkout@master
34+
with:
35+
ref: ${{ github.ref_name }}
36+
37+
- name: Setup pnpm
38+
uses: pnpm/action-setup@v2
39+
40+
- name: Setup Node
41+
uses: actions/setup-node@v3
42+
with:
43+
node-version: 20.10.0
44+
registry-url: 'https://registry.npmjs.org'
45+
46+
- name: Get pnpm store directory
47+
id: pnpm-cache
48+
run: |
49+
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
50+
51+
- uses: actions/cache@v3
52+
name: Setup pnpm cache
53+
with:
54+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
55+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
56+
restore-keys: |
57+
${{ runner.os }}-pnpm-store-
58+
59+
- name: Install dependencies
60+
run: pnpm i --no-frozen-lockfile
61+
62+
- name: Run Build Components
63+
run: pnpm build:ui ${{ inputs.components }}
64+
65+
- name: Run Release alpha
66+
run: pnpm release:alpha
67+
68+
- name: Publish
69+
run: |
70+
pnpm pub:all
71+
env:
72+
NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }}

0 commit comments

Comments
 (0)