ci(workflows): add utils package build and release automation process (#2838)

* ci(workflows): add utils package build and release automation process

* ci(workflows): add utils package build and release automation process
This commit is contained in:
ajaxzheng 2025-01-24 14:56:02 +08:00 committed by GitHub
parent f4ba86e4f0
commit a34e529cca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 35 additions and 6 deletions

View File

@ -67,11 +67,14 @@ jobs:
- name: Run Build ThemeMobile - name: Run Build ThemeMobile
run: pnpm build:themeMobile run: pnpm build:themeMobile
- name: Run Build Utils
run: pnpm build:utils
- name: Run Build Runtime - name: Run Build Runtime
run: pnpm build:runtime run: pnpm build:runtime
- name: Publish Vue3 And Vue2 components - name: Publish Vue3 And Vue2 components
run: pnpm pub:all run: pnpm pub:all && pnpm pub:utils
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@ -79,6 +79,9 @@ jobs:
- name: Run Build ThemeMobile - name: Run Build ThemeMobile
run: pnpm build:themeMobile run: pnpm build:themeMobile
- name: Run Build Utils
run: pnpm build:utils
- name: Run Build Runtime - name: Run Build Runtime
run: pnpm build:runtime run: pnpm build:runtime
@ -86,6 +89,6 @@ jobs:
run: pnpm release:alpha run: pnpm release:alpha
- name: Publish Vue3 And Vue2 components - name: Publish Vue3 And Vue2 components
run: pnpm pub:all && pnpm pub:site run: pnpm pub:all && pnpm pub:utils && pnpm pub:site
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }}

View File

@ -7,7 +7,7 @@ on:
components: components:
description: | description: |
输入需要打包的模块名称,多个以英文逗号分隔, 输入需要打包的模块名称,多个以英文逗号分隔,
例如: `theme,renderless,runtime,docs` 例如: `theme,renderless,runtime,docs,utils`
required: true required: true
type: string type: string
concurrency: concurrency:
@ -25,8 +25,9 @@ jobs:
script: | script: |
const branchName = `${{ github.ref_name }}` const branchName = `${{ github.ref_name }}`
const moduleName = `${{ inputs.components }}` const moduleName = `${{ inputs.components }}`
const validModuleNames = ['theme', 'renderless', 'runtime', 'docs','utils']
if (!moduleName.includes('theme') && !moduleName.includes('renderless') && !moduleName.includes('docs') && !moduleName.includes('runtime')) { if (!validModuleNames.some(name => moduleName.includes(name))) {
throw new Error('请输入正确的包名称') throw new Error('请输入正确的包名称')
} }
@ -80,6 +81,10 @@ jobs:
if: contains(inputs.components, 'runtime') == true if: contains(inputs.components, 'runtime') == true
run: pnpm build:runtime run: pnpm build:runtime
- name: Run Build Utils
if: contains(inputs.components, 'utils') == true
run: pnpm build:utils
- name: Run Release alpha - name: Run Release alpha
run: pnpm release:alpha -u run: pnpm release:alpha -u
@ -89,6 +94,13 @@ jobs:
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }}
- name: Publish Utils
if: contains(inputs.components, 'utils') == true
run: |
pnpm pub:utils
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }}
- name: Publish Docs - name: Publish Docs
if: contains(inputs.components, 'docs') == true if: contains(inputs.components, 'docs') == true
run: | run: |

View File

@ -36,7 +36,9 @@ const findAllpage = (packagesPath, updateVersion) => {
}) })
} else { } else {
const content = fs.readFileSync(packagesPath).toString('UTF-8' as BufferEncoding) const content = fs.readFileSync(packagesPath).toString('UTF-8' as BufferEncoding)
const result = content.replace(/@opentiny\/vue/g, '@opentinyvue/vue') const result = content
.replace(/@opentiny\/vue/g, '@opentinyvue/vue')
.replace(/@opentiny\/utils/g, '@opentinyvue/utils')
if (packagesPath.endsWith('package.json') && updateVersion) { if (packagesPath.endsWith('package.json') && updateVersion) {
const packageJSON = JSON.parse(result) const packageJSON = JSON.parse(result)
@ -63,7 +65,15 @@ const releaseSiteAlpha = (updateVersion) => {
} }
export const releaseAlpha = ({ updateVersion }) => { export const releaseAlpha = ({ updateVersion }) => {
const distLists = ['dist3/', 'dist2/', 'renderless/dist', 'theme/dist', 'theme-mobile/dist', 'theme-saas/dist'] const distLists = [
'dist3/',
'dist2/',
'renderless/dist',
'theme/dist',
'theme-mobile/dist',
'theme-saas/dist',
'utils'
]
distLists.forEach((item) => { distLists.forEach((item) => {
findAllpage(pathFromPackages(item), updateVersion) findAllpage(pathFromPackages(item), updateVersion)
}) })

View File

@ -82,6 +82,7 @@
"pub:themeSaas": "pnpm --filter=\"./packages/theme-saas/dist\" publish --no-git-checks --access=public", "pub:themeSaas": "pnpm --filter=\"./packages/theme-saas/dist\" publish --no-git-checks --access=public",
"pub:renderless": "pnpm --filter=\"./packages/renderless/dist\" publish --no-git-checks --access=public", "pub:renderless": "pnpm --filter=\"./packages/renderless/dist\" publish --no-git-checks --access=public",
"pub:runtime": "pnpm --filter=\"./packages/vue-runtime/\" publish --no-git-checks --access=public", "pub:runtime": "pnpm --filter=\"./packages/vue-runtime/\" publish --no-git-checks --access=public",
"pub:utils": "pnpm --filter=\"./packages/utils/\" publish --no-git-checks --access=public",
"pub:all": "pnpm pub2 && pnpm pub3 && pnpm pub:theme && pnpm pub:themeMobile && pnpm pub:themeSaas && pnpm pub:renderless && pnpm pub:runtime", "pub:all": "pnpm pub2 && pnpm pub3 && pnpm pub:theme && pnpm pub:themeMobile && pnpm pub:themeSaas && pnpm pub:renderless && pnpm pub:runtime",
"pub:site": "pnpm -C examples/sites pub", "pub:site": "pnpm -C examples/sites pub",
"// ---------- 自动化发测试包 ----------": "", "// ---------- 自动化发测试包 ----------": "",