Skip to content

Commit 65a9797

Browse files
committed
ci(workflows): add utils package build and release automation process
1 parent 8f2ffe1 commit 65a9797

File tree

5 files changed

+34
-5
lines changed

5 files changed

+34
-5
lines changed

.github/workflows/auto-all-publish.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,14 @@ jobs:
6767
- name: Run Build ThemeMobile
6868
run: pnpm build:themeMobile
6969

70+
- name: Run Build Utils
71+
run: pnpm build:utils
72+
7073
- name: Run Build Runtime
7174
run: pnpm build:runtime
7275

7376
- name: Publish Vue3 And Vue2 components
74-
run: pnpm pub:all
77+
run: pnpm pub:all && pnpm pub:utils
7578
env:
7679
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7780

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,16 @@ jobs:
7979
- name: Run Build ThemeMobile
8080
run: pnpm build:themeMobile
8181

82+
- name: Run Build Utils
83+
run: pnpm build:utils
84+
8285
- name: Run Build Runtime
8386
run: pnpm build:runtime
8487

8588
- name: Run Release alpha
8689
run: pnpm release:alpha
8790

8891
- name: Publish Vue3 And Vue2 components
89-
run: pnpm pub:all && pnpm pub:site
92+
run: pnpm pub:all && pnpm pub:utils && pnpm pub:site
9093
env:
9194
NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }}

.github/workflows/dispatch-renderless-theme-publish-alpha.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ jobs:
2525
script: |
2626
const branchName = `${{ github.ref_name }}`
2727
const moduleName = `${{ inputs.components }}`
28+
const validModuleNames = ['theme', 'renderless', 'runtime', 'docs','utils']
2829
29-
if (!moduleName.includes('theme') && !moduleName.includes('renderless') && !moduleName.includes('docs') && !moduleName.includes('runtime')) {
30+
if (!validModuleNames.some(name => moduleName.includes(name))) {
3031
throw new Error('请输入正确的包名称')
3132
}
3233
@@ -80,6 +81,10 @@ jobs:
8081
if: contains(inputs.components, 'runtime') == true
8182
run: pnpm build:runtime
8283

84+
- name: Run Build Utils
85+
if: contains(inputs.components, 'utils') == true
86+
run: pnpm build:utils
87+
8388
- name: Run Release alpha
8489
run: pnpm release:alpha -u
8590

@@ -89,6 +94,13 @@ jobs:
8994
env:
9095
NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }}
9196

97+
- name: Publish Utils
98+
if: contains(inputs.components, 'utils') == true
99+
run: |
100+
pnpm pub:utils
101+
env:
102+
NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }}
103+
92104
- name: Publish Docs
93105
if: contains(inputs.components, 'docs') == true
94106
run: |

internals/cli/src/commands/release/releaseAlpha.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ const findAllpage = (packagesPath, updateVersion) => {
3636
})
3737
} else {
3838
const content = fs.readFileSync(packagesPath).toString('UTF-8' as BufferEncoding)
39-
const result = content.replace(/@opentiny\/vue/g, '@opentinyvue/vue')
39+
const result = content
40+
.replace(/@opentiny\/vue/g, '@opentinyvue/vue')
41+
.replace(/@opentiny\/utils/g, '@opentinyvue/utils')
4042

4143
if (packagesPath.endsWith('package.json') && updateVersion) {
4244
const packageJSON = JSON.parse(result)
@@ -63,7 +65,15 @@ const releaseSiteAlpha = (updateVersion) => {
6365
}
6466

6567
export const releaseAlpha = ({ updateVersion }) => {
66-
const distLists = ['dist3/', 'dist2/', 'renderless/dist', 'theme/dist', 'theme-mobile/dist', 'theme-saas/dist']
68+
const distLists = [
69+
'dist3/',
70+
'dist2/',
71+
'renderless/dist',
72+
'theme/dist',
73+
'theme-mobile/dist',
74+
'theme-saas/dist',
75+
'utils'
76+
]
6777
distLists.forEach((item) => {
6878
findAllpage(pathFromPackages(item), updateVersion)
6979
})

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"pub:themeSaas": "pnpm --filter=\"./packages/theme-saas/dist\" publish --no-git-checks --access=public",
8383
"pub:renderless": "pnpm --filter=\"./packages/renderless/dist\" publish --no-git-checks --access=public",
8484
"pub:runtime": "pnpm --filter=\"./packages/vue-runtime/\" publish --no-git-checks --access=public",
85+
"pub:utils": "pnpm --filter=\"./packages/utils/\" publish --no-git-checks --access=public",
8586
"pub:all": "pnpm pub2 && pnpm pub3 && pnpm pub:theme && pnpm pub:themeMobile && pnpm pub:themeSaas && pnpm pub:renderless && pnpm pub:runtime",
8687
"pub:site": "pnpm -C examples/sites pub",
8788
"// ---------- 自动化发测试包 ----------": "",

0 commit comments

Comments
 (0)