ci: 构建流程优化 - test环境固定/平台选择/版本号自动更新/缓存

- VITE_API_BASE_URL 固定为 dev.tapi.meijiaka.cn(test环境)
- 添加 platform 选择(all/macos/windows),支持单独构建
- 添加版本号自动更新(tauri.conf.json + Cargo.toml)
- 添加 Rust + Node 构建缓存,节省CI额度
- 修复 ViduAdapter parse_callback 运算符优先级bug
- 修复 ViduProvider tts_sync 日志前缀误写
- VoiceSynthesis 空状态UI优化
This commit is contained in:
小鱼开发
2026-05-19 15:17:36 +08:00
parent 66db8a0788
commit 9ddcb2347d
5 changed files with 97 additions and 14 deletions
+63 -7
View File
@@ -10,18 +10,20 @@ on:
description: '版本号 (例如 1.5.16)'
required: true
type: string
environment:
description: '构建环境'
platform:
description: '构建平台'
required: true
type: choice
options:
- test
- prod
default: test
- all
- macos
- windows
default: all
jobs:
build-macos:
name: Build macOS (Universal)
if: ${{ github.event_name == 'push' || inputs.platform == 'all' || inputs.platform == 'macos' }}
runs-on: macos-latest
steps:
- name: Checkout
@@ -37,6 +39,21 @@ jobs:
with:
targets: x86_64-apple-darwin,aarch64-apple-darwin
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
tauri-app/src-tauri/target
key: ${{ runner.os }}-cargo-${{ hashFiles('tauri-app/src-tauri/Cargo.lock') }}
- name: Cache Node dependencies
uses: actions/cache@v4
with:
path: tauri-app/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('tauri-app/package-lock.json') }}
- name: Download sidecar binaries
run: |
mkdir -p tauri-app/src-tauri/binaries
@@ -62,11 +79,22 @@ jobs:
working-directory: tauri-app
run: npm ci
- name: Update version
run: |
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
else
VERSION="${GITHUB_REF_NAME#v}"
fi
perl -pi -e "s/\"version\"\s*:\s*\"[^\"]*\"/\"version\": \"$VERSION\"/" tauri-app/src-tauri/tauri.conf.json
perl -pi -e "s/^version = \"[^\"]*\"/version = \"$VERSION\"/" tauri-app/src-tauri/Cargo.toml
echo "Version updated to: $VERSION"
- name: Build macOS Universal
working-directory: tauri-app
run: npm run tauri -- build --target universal-apple-darwin
env:
VITE_API_BASE_URL: ${{ inputs.environment == 'prod' && 'https://tapi.meijiaka.cn/api/v1' || 'https://dev.tapi.meijiaka.cn/api/v1' }}
VITE_API_BASE_URL: https://dev.tapi.meijiaka.cn/api/v1
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
@@ -80,6 +108,7 @@ jobs:
build-windows:
name: Build Windows (x64)
if: ${{ github.event_name == 'push' || inputs.platform == 'all' || inputs.platform == 'windows' }}
runs-on: windows-latest
steps:
- name: Checkout
@@ -95,6 +124,21 @@ jobs:
with:
targets: x86_64-pc-windows-msvc
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
tauri-app/src-tauri/target
key: ${{ runner.os }}-cargo-${{ hashFiles('tauri-app/src-tauri/Cargo.lock') }}
- name: Cache Node dependencies
uses: actions/cache@v4
with:
path: tauri-app/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('tauri-app/package-lock.json') }}
- name: Download sidecar binaries
shell: pwsh
run: |
@@ -108,12 +152,24 @@ jobs:
working-directory: tauri-app
run: npm ci
- name: Update version
shell: pwsh
run: |
$version = if ("${{ inputs.version }}") { "${{ inputs.version }}" } else { $env:GITHUB_REF_NAME -replace '^v', '' }
$content = Get-Content tauri-app/src-tauri/tauri.conf.json -Raw
$content = $content -replace '"version"\s*:\s*"[^"]*"', "`"version`": `"$version`""
Set-Content tauri-app/src-tauri/tauri.conf.json -Value $content
$cargo = Get-Content tauri-app/src-tauri/Cargo.toml -Raw
$cargo = $cargo -replace '^version = "[^"]*"', "version = `"$version`""
Set-Content tauri-app/src-tauri/Cargo.toml -Value $cargo
Write-Host "Version updated to: $version"
- name: Build Windows x64
working-directory: tauri-app
shell: pwsh
run: npm run tauri -- build --target x86_64-pc-windows-msvc
env:
VITE_API_BASE_URL: ${{ inputs.environment == 'prod' && 'https://tapi.meijiaka.cn/api/v1' || 'https://dev.tapi.meijiaka.cn/api/v1' }}
VITE_API_BASE_URL: https://dev.tapi.meijiaka.cn/api/v1
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}