Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/auto-all-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/dispatch-all-publish-alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,16 @@ 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: Run Release alpha
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 }}
16 changes: 14 additions & 2 deletions .github/workflows/dispatch-renderless-theme-publish-alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
components:
description: |
输入需要打包的模块名称,多个以英文逗号分隔,
例如: `theme,renderless,runtime,docs`
例如: `theme,renderless,runtime,docs,utils`
required: true
type: string
concurrency:
Expand All @@ -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('请输入正确的包名称')
}

Expand Down Expand Up @@ -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

Expand All @@ -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: |
Expand Down
14 changes: 12 additions & 2 deletions internals/cli/src/commands/release/releaseAlpha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ const findAllpage = (packagesPath, updateVersion) => {
})
} else {
const content = fs.readFileSync(packagesPath).toString('UTF-8' as BufferEncoding)
zzcr marked this conversation as resolved.
Show resolved Hide resolved
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)
Expand All @@ -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)
})
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"// ---------- 自动化发测试包 ----------": "",
Expand Down
Loading