-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(workflows): add script for full release of alpha test package (#2785)
* ci(workflows): add script for full release of alpha test package * fix: 修复检视意见
- Loading branch information
Showing
5 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Dispatch All Publish Alpha | ||
run-name: Dispatch All Publish Alpha--${{ inputs.version }} | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: | | ||
输入您将要发布的版本号, | ||
例如: `3.xx.xx`. | ||
required: true | ||
type: string | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
outputs: | ||
publishVersion: ${{ steps.parseVersion.outputs.publishVersion }} | ||
steps: | ||
- name: Parse Version | ||
id: parseVersion | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const version = `${{ inputs.version }}` | ||
if(!/^\d\.\d+\.\d+/.test(vserion)) { | ||
throw new Error('版本号格式不正确') | ||
} | ||
const publishVersion = version.slice(2) | ||
core.setOutput('publishVersion', publishVersion) | ||
- name: CheckOut Code | ||
uses: actions/checkout@master | ||
with: | ||
ref: ${{ github.ref_name }} | ||
|
||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v2 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.10.0 | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Get pnpm store directory | ||
id: pnpm-cache | ||
run: | | ||
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
- uses: actions/cache@v3 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm i --no-frozen-lockfile | ||
|
||
- name: Run Build Components | ||
run: pnpm build:ui -t ${{ steps.parseVersion.outputs.publishVersion }} | ||
|
||
- name: Run Build Sass Common | ||
run: pnpm build:ui saas-common -t ${{ steps.parseVersion.outputs.publishVersion }} -d saas | ||
|
||
- name: Run Build Theme | ||
run: pnpm build:theme | ||
|
||
- name: Run Build Renderless | ||
run: pnpm build:renderless | ||
|
||
- name: Run Build ThemeSaas | ||
run: pnpm build:themeSaas | ||
|
||
- name: Run Build ThemeMobile | ||
run: pnpm build:themeMobile | ||
|
||
- 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 | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_OPENTINY_VUE_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { pathFromPackages } from '../build/build-ui' | ||
import path from 'node:path' | ||
import fs from 'fs-extra' | ||
|
||
const excludeFiles = ['.png', '.gif', '.jpeg', '.jpg', '.ttf', 'node_modules'] | ||
|
||
// 递归遍历所有的组件,然后依次修改文件内容 | ||
const findAllpage = (packagesPath) => { | ||
if (excludeFiles.some((item) => packagesPath.includes(item)) || !fs.existsSync(packagesPath)) { | ||
return | ||
} | ||
|
||
if (fs.statSync(packagesPath).isDirectory()) { | ||
// 循环递归查找子文件夹 | ||
fs.readdirSync(packagesPath).forEach((childPatch) => { | ||
findAllpage(path.join(packagesPath, childPatch)) | ||
}) | ||
} else { | ||
const content = fs.readFileSync(packagesPath).toString('UTF-8' as BufferEncoding) | ||
let result = content.replace(/@opentiny\/vue/g, '@opentinyvue/vue') | ||
|
||
fs.writeFileSync(packagesPath, result) | ||
} | ||
} | ||
|
||
export const releaseAlpha = () => { | ||
const distLists = ['dist3/', 'dist2/', 'renderless/dist', 'theme/dist', 'theme-mobile/dist', 'theme-saas/dist'] | ||
distLists.forEach((item) => { | ||
findAllpage(pathFromPackages(item)) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters