From 65a97973536bcc717cf80f742d13bdd9a827582e Mon Sep 17 00:00:00 2001 From: ajaxzheng <894103554@qq.com> Date: Wed, 22 Jan 2025 14:28:12 +0800 Subject: [PATCH 1/2] ci(workflows): add utils package build and release automation process --- .github/workflows/auto-all-publish.yml | 5 ++++- .github/workflows/dispatch-all-publish-alpha.yml | 5 ++++- .../dispatch-renderless-theme-publish-alpha.yml | 14 +++++++++++++- internals/cli/src/commands/release/releaseAlpha.ts | 14 ++++++++++++-- package.json | 1 + 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/.github/workflows/auto-all-publish.yml b/.github/workflows/auto-all-publish.yml index e90c8941b6..7f89e264a1 100644 --- a/.github/workflows/auto-all-publish.yml +++ b/.github/workflows/auto-all-publish.yml @@ -67,11 +67,14 @@ jobs: - name: Run Build ThemeMobile run: pnpm build:themeMobile + - name: Run Build Utils + run: pnpm build:utils + - name: Run Build Runtime run: pnpm build:runtime - name: Publish Vue3 And Vue2 components - run: pnpm pub:all + run: pnpm pub:all && pnpm pub:utils env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/dispatch-all-publish-alpha.yml b/.github/workflows/dispatch-all-publish-alpha.yml index 8de40e1fbd..b6bf2c39b2 100644 --- a/.github/workflows/dispatch-all-publish-alpha.yml +++ b/.github/workflows/dispatch-all-publish-alpha.yml @@ -79,6 +79,9 @@ jobs: - name: Run Build ThemeMobile run: pnpm build:themeMobile + - name: Run Build Utils + run: pnpm build:utils + - name: Run Build Runtime run: pnpm build:runtime @@ -86,6 +89,6 @@ jobs: run: pnpm release:alpha - name: Publish Vue3 And Vue2 components - run: pnpm pub:all && pnpm pub:site + run: pnpm pub:all && pnpm pub:utils && pnpm pub:site env: NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }} diff --git a/.github/workflows/dispatch-renderless-theme-publish-alpha.yml b/.github/workflows/dispatch-renderless-theme-publish-alpha.yml index 5b27663843..235ad74b5f 100644 --- a/.github/workflows/dispatch-renderless-theme-publish-alpha.yml +++ b/.github/workflows/dispatch-renderless-theme-publish-alpha.yml @@ -25,8 +25,9 @@ jobs: script: | const branchName = `${{ github.ref_name }}` 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('请输入正确的包名称') } @@ -80,6 +81,10 @@ jobs: if: contains(inputs.components, 'runtime') == true run: pnpm build:runtime + - name: Run Build Utils + if: contains(inputs.components, 'utils') == true + run: pnpm build:utils + - name: Run Release alpha run: pnpm release:alpha -u @@ -89,6 +94,13 @@ jobs: env: 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 if: contains(inputs.components, 'docs') == true run: | diff --git a/internals/cli/src/commands/release/releaseAlpha.ts b/internals/cli/src/commands/release/releaseAlpha.ts index 62f3db3fff..7ebdfdf6c6 100644 --- a/internals/cli/src/commands/release/releaseAlpha.ts +++ b/internals/cli/src/commands/release/releaseAlpha.ts @@ -36,7 +36,9 @@ const findAllpage = (packagesPath, updateVersion) => { }) } else { 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) { const packageJSON = JSON.parse(result) @@ -63,7 +65,15 @@ const releaseSiteAlpha = (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) => { findAllpage(pathFromPackages(item), updateVersion) }) diff --git a/package.json b/package.json index d629d131f7..1c04addbdc 100644 --- a/package.json +++ b/package.json @@ -82,6 +82,7 @@ "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: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:site": "pnpm -C examples/sites pub", "// ---------- 自动化发测试包 ----------": "", From 3f35abada80ba9c29e8df2b78d7f813cf5a9ae79 Mon Sep 17 00:00:00 2001 From: ajaxzheng <894103554@qq.com> Date: Wed, 22 Jan 2025 14:31:26 +0800 Subject: [PATCH 2/2] ci(workflows): add utils package build and release automation process --- .github/workflows/dispatch-renderless-theme-publish-alpha.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dispatch-renderless-theme-publish-alpha.yml b/.github/workflows/dispatch-renderless-theme-publish-alpha.yml index 235ad74b5f..2f385b1d83 100644 --- a/.github/workflows/dispatch-renderless-theme-publish-alpha.yml +++ b/.github/workflows/dispatch-renderless-theme-publish-alpha.yml @@ -7,7 +7,7 @@ on: components: description: | 输入需要打包的模块名称,多个以英文逗号分隔, - 例如: `theme,renderless,runtime,docs` + 例如: `theme,renderless,runtime,docs,utils` required: true type: string concurrency: