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 vue-docs test package release script #2824

Merged
merged 2 commits into from
Jan 20, 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
2 changes: 1 addition & 1 deletion .github/workflows/dispatch-all-publish-alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ jobs:
run: pnpm release:alpha

- name: Publish Vue3 And Vue2 components
run: pnpm pub:all
run: pnpm pub:all && pnpm pub:site
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }}
11 changes: 9 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`
例如: `theme,renderless,runtime,docs`
required: true
type: string
concurrency:
Expand All @@ -26,7 +26,7 @@ jobs:
const branchName = `${{ github.ref_name }}`
const moduleName = `${{ inputs.components }}`

if (!moduleName.includes('theme') && !moduleName.includes('renderless') && !moduleName.includes('runtime')) {
if (!moduleName.includes('theme') && !moduleName.includes('renderless') && !moduleName.includes('docs') && !moduleName.includes('runtime')) {
throw new Error('请输入正确的包名称')
}

Expand Down Expand Up @@ -88,3 +88,10 @@ jobs:
pnpm pub:all
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }}

- name: Publish Docs
if: contains(inputs.components, 'docs') == true
run: |
pnpm pub:site
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }}
16 changes: 16 additions & 0 deletions internals/cli/src/commands/release/releaseAlpha.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { pathFromPackages } from '../build/build-ui'
import { pathFromExamples } from './releaseE2EConfig'
import path from 'node:path'
import fs from 'fs-extra'
import semver from 'semver'
Expand Down Expand Up @@ -47,9 +48,24 @@ const findAllpage = (packagesPath, updateVersion) => {
}
}

const releaseSiteAlpha = (updateVersion) => {
const PKG_PATH = pathFromExamples('sites/package.json')
const PKGContent = fs.readJSONSync(PKG_PATH)

PKGContent.name = PKGContent.name.replace('@opentiny', '@opentinyvue')
if (updateVersion) {
PKGContent.version = getPatchVersion(PKGContent.name, PKGContent.version)
zzcr marked this conversation as resolved.
Show resolved Hide resolved
}
PKGContent.devDependencies = { ...PKGContent.devDependencies, ...PKGContent.dependencies }
delete PKGContent.dependencies

fs.writeFileSync(PKG_PATH, JSON.stringify(PKGContent, null, 2))
}
zzcr marked this conversation as resolved.
Show resolved Hide resolved

export const releaseAlpha = ({ updateVersion }) => {
const distLists = ['dist3/', 'dist2/', 'renderless/dist', 'theme/dist', 'theme-mobile/dist', 'theme-saas/dist']
distLists.forEach((item) => {
findAllpage(pathFromPackages(item), updateVersion)
})
releaseSiteAlpha(updateVersion)
}
2 changes: 1 addition & 1 deletion internals/cli/src/commands/release/releaseE2EConfig.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs-extra'
import { pathFromWorkspaceRoot } from '../../config/vite'

const pathFromExamples = (...args) => pathFromWorkspaceRoot('examples', ...args)
export const pathFromExamples = (...args) => pathFromWorkspaceRoot('examples', ...args)

const playWrightConfigPath = pathFromExamples('vue3/playwright.config.js')

Expand Down
Loading