完善workflows
This commit is contained in:
parent
c5803954c7
commit
f0c3e8b59a
251
.github/workflows/debug.yml
vendored
Normal file
251
.github/workflows/debug.yml
vendored
Normal file
@ -0,0 +1,251 @@
|
|||||||
|
name: 构建测试
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
debug:
|
||||||
|
description: "启用调试模式"
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
NODE_VERSION: "24"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# ==================== Windows 构建 ====================
|
||||||
|
build-Windows:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
arch: [x64, arm64]
|
||||||
|
|
||||||
|
runs-on: windows-latest
|
||||||
|
name: 构建 Windows (${{ matrix.arch }})
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 检出代码
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 配置 Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
|
||||||
|
- name: 缓存依赖
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: windows-${{ matrix.arch }}-modules-${{ hashFiles('yarn.lock') }}
|
||||||
|
|
||||||
|
- name: 安装依赖
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: yarn install --frozen-lockfile
|
||||||
|
env:
|
||||||
|
npm_config_arch: ${{ matrix.arch }}
|
||||||
|
|
||||||
|
- name: 调试 - 显示环境信息
|
||||||
|
if: ${{ inputs.debug }}
|
||||||
|
run: |
|
||||||
|
echo "===== 系统信息 ====="
|
||||||
|
systeminfo | findstr /B /C:"OS"
|
||||||
|
echo "===== Node 版本 ====="
|
||||||
|
node -v
|
||||||
|
echo "===== Yarn 版本 ====="
|
||||||
|
yarn -v
|
||||||
|
echo "===== 目标架构 ====="
|
||||||
|
echo "${{ matrix.arch }}"
|
||||||
|
|
||||||
|
- name: 构建应用
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: 调试 - 显示构建产物
|
||||||
|
if: ${{ inputs.debug }}
|
||||||
|
run: |
|
||||||
|
echo "===== 构建目录内容 ====="
|
||||||
|
dir dist 2>nul || echo "dist 目录不存在"
|
||||||
|
|
||||||
|
- name: 打包 Windows 安装程序
|
||||||
|
run: yarn dist:win --${{ matrix.arch }}
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: 调试 - 显示打包产物
|
||||||
|
if: ${{ inputs.debug }}
|
||||||
|
run: |
|
||||||
|
echo "===== 最终产物 ====="
|
||||||
|
dir dist\*.exe
|
||||||
|
|
||||||
|
- name: 上传构建产物
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: windows-${{ matrix.arch }}
|
||||||
|
path: dist/*.exe
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
|
# ==================== macOS 构建 ====================
|
||||||
|
build-macOS:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- arch: arm64
|
||||||
|
os: macos-14
|
||||||
|
name: Apple Silicon
|
||||||
|
- arch: x64
|
||||||
|
os: macos-13
|
||||||
|
name: Intel
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
name: 构建 macOS (${{ matrix.name }})
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 检出代码
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 配置 Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
|
||||||
|
- name: 缓存依赖
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: macos-${{ matrix.arch }}-modules-${{ hashFiles('yarn.lock') }}
|
||||||
|
|
||||||
|
- name: 安装依赖
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: 调试 - 显示环境信息
|
||||||
|
if: ${{ inputs.debug }}
|
||||||
|
run: |
|
||||||
|
echo "===== 系统信息 ====="
|
||||||
|
uname -a
|
||||||
|
echo "===== 系统架构 ====="
|
||||||
|
uname -m
|
||||||
|
echo "===== Node 版本 ====="
|
||||||
|
node -v
|
||||||
|
echo "===== Yarn 版本 ====="
|
||||||
|
yarn -v
|
||||||
|
|
||||||
|
- name: 调试 - 验证 native 模块架构
|
||||||
|
if: ${{ inputs.debug }}
|
||||||
|
run: |
|
||||||
|
echo "===== sharp 模块架构 ====="
|
||||||
|
file node_modules/sharp/build/Release/*.node 2>/dev/null || echo "sharp 未安装"
|
||||||
|
echo "===== 其他 native 模块 ====="
|
||||||
|
find node_modules -name "*.node" -exec file {} \; 2>/dev/null | head -20
|
||||||
|
|
||||||
|
- name: 构建应用
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: 调试 - 显示构建产物
|
||||||
|
if: ${{ inputs.debug }}
|
||||||
|
run: |
|
||||||
|
echo "===== 构建目录内容 ====="
|
||||||
|
ls -la dist/ 2>/dev/null || echo "dist 目录不存在"
|
||||||
|
|
||||||
|
- name: 打包 macOS 安装程序
|
||||||
|
run: yarn dist:mac
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: 调试 - 显示打包产物
|
||||||
|
if: ${{ inputs.debug }}
|
||||||
|
run: |
|
||||||
|
echo "===== 最终产物 ====="
|
||||||
|
ls -la dist/*.dmg
|
||||||
|
|
||||||
|
- name: 上传构建产物
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: macos-${{ matrix.arch }}
|
||||||
|
path: dist/*.dmg
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
|
# ==================== Linux 构建 ====================
|
||||||
|
build-Linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: 构建 Linux (x64)
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 检出代码
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 配置 Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
cache: "yarn"
|
||||||
|
|
||||||
|
- name: 安装依赖
|
||||||
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: 调试 - 显示环境信息
|
||||||
|
if: ${{ inputs.debug }}
|
||||||
|
run: |
|
||||||
|
echo "===== 系统信息 ====="
|
||||||
|
uname -a
|
||||||
|
echo "===== 系统架构 ====="
|
||||||
|
uname -m
|
||||||
|
echo "===== Node 版本 ====="
|
||||||
|
node -v
|
||||||
|
echo "===== Yarn 版本 ====="
|
||||||
|
yarn -v
|
||||||
|
|
||||||
|
- name: 调试 - 验证 native 模块架构
|
||||||
|
if: ${{ inputs.debug }}
|
||||||
|
run: |
|
||||||
|
echo "===== sharp 模块架构 ====="
|
||||||
|
file node_modules/sharp/build/Release/*.node 2>/dev/null || echo "sharp 未安装"
|
||||||
|
|
||||||
|
- name: 构建应用
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: 打包 Linux 安装程序
|
||||||
|
run: yarn dist:linux
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: 调试 - 显示打包产物
|
||||||
|
if: ${{ inputs.debug }}
|
||||||
|
run: |
|
||||||
|
echo "===== 最终产物 ====="
|
||||||
|
ls -la dist/*.AppImage
|
||||||
|
|
||||||
|
- name: 上传构建产物
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: linux-x64
|
||||||
|
path: dist/*.AppImage
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
|
# ==================== 构建摘要 ====================
|
||||||
|
summary:
|
||||||
|
needs: [build-Windows, build-macOS, build-Linux]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: 构建摘要
|
||||||
|
if: always()
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 输出构建结果
|
||||||
|
run: |
|
||||||
|
echo "===== 构建测试完成 ====="
|
||||||
|
echo "Windows x64: ${{ needs.build-Windows.result }}"
|
||||||
|
echo "Windows arm64: ${{ needs.build-Windows.result }}"
|
||||||
|
echo "macOS Apple Silicon: ${{ needs.build-macOS.result }}"
|
||||||
|
echo "macOS Intel: ${{ needs.build-macOS.result }}"
|
||||||
|
echo "Linux x64: ${{ needs.build-Linux.result }}"
|
||||||
|
echo ""
|
||||||
|
echo "构建产物将保留 7 天,可在 Actions 页面下载。"
|
||||||
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
@ -11,15 +11,9 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
skipRelease:
|
|
||||||
description: "跳过发布(仅构建测试)"
|
|
||||||
required: false
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
NODE_VERSION: "24"
|
NODE_VERSION: "24"
|
||||||
SKIP_RELEASE: ${{ inputs.skipRelease || false }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# ==================== Windows 构建 ====================
|
# ==================== Windows 构建 ====================
|
||||||
@ -238,7 +232,7 @@ jobs:
|
|||||||
needs: [build-Windows, build-macOS, build-Linux]
|
needs: [build-Windows, build-macOS, build-Linux]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: 发布到 GitHub
|
name: 发布到 GitHub
|
||||||
if: startsWith(github.ref, 'refs/tags/') && inputs.skipRelease != true
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@ -294,4 +288,4 @@ jobs:
|
|||||||
- name: 发布完成
|
- name: 发布完成
|
||||||
run: |
|
run: |
|
||||||
echo "✅ 发布完成!"
|
echo "✅ 发布完成!"
|
||||||
echo "🔗 Release: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}"
|
echo "🔗 Release: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user