mirror of
https://github.com/Hommy-master/capcut-mate.git
synced 2026-08-28 23:27:50 +08:00
120 lines
3.6 KiB
YAML
120 lines
3.6 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, dev ]
|
|
tags: [ 'v*' ]
|
|
pull_request:
|
|
branches: [ main, dev ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: windows-latest
|
|
platform: win
|
|
artifact_name: windows-build
|
|
build_command: build-win
|
|
installer_command: build-win-installer
|
|
green_command: build-win-green
|
|
- os: macos-latest
|
|
platform: mac
|
|
artifact_name: macos-build
|
|
build_command: build-mac
|
|
installer_command: build-mac-installer
|
|
green_command: build-mac-green
|
|
- os: macos-15-intel
|
|
platform: mac-x64
|
|
artifact_name: macos-build-x64
|
|
build_command: build-mac-x64
|
|
installer_command: build-mac-x64-installer
|
|
green_command: build-mac-x64-green
|
|
|
|
steps:
|
|
- name: 准备代码
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 设置Node.js环境
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
cache: 'npm'
|
|
cache-dependency-path: desktop-client/package-lock.json
|
|
|
|
- name: 安装Electron依赖
|
|
run: npm ci
|
|
working-directory: ./desktop-client
|
|
|
|
- name: 安装前端依赖
|
|
run: npm ci
|
|
working-directory: ./desktop-client/web
|
|
|
|
- name: 构建前端
|
|
run: npm run build
|
|
working-directory: ./desktop-client/web
|
|
|
|
- name: 更新版本号
|
|
run: node scripts/update-version.js
|
|
working-directory: ./desktop-client
|
|
env:
|
|
GITHUB_REF: ${{ github.ref }}
|
|
|
|
- name: 根据平台打包应用程序
|
|
run: npm run ${{ matrix.build_command }}
|
|
working-directory: ./desktop-client
|
|
|
|
- name: 根据平台创建安装包
|
|
run: npm run ${{ matrix.installer_command }}
|
|
working-directory: ./desktop-client
|
|
env:
|
|
# 添加环境变量以解决macOS构建问题
|
|
CSC_IDENTITY_AUTO_DISCOVERY: false
|
|
DEBUG: electron-builder
|
|
|
|
- name: 构建绿色安装包
|
|
if: matrix.green_command != 'null'
|
|
run: npm run ${{ matrix.green_command }}
|
|
working-directory: ./desktop-client
|
|
env:
|
|
# 添加环境变量以解决macOS构建问题
|
|
CSC_IDENTITY_AUTO_DISCOVERY: false
|
|
DEBUG: electron-builder
|
|
|
|
- name: 列出dist目录内容
|
|
run: |
|
|
echo "当前操作系统: ${{ runner.os }}"
|
|
ls desktop-client/dist/
|
|
shell: bash
|
|
|
|
- name: 上传安装包构件
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.artifact_name }}-installer
|
|
path: desktop-client/dist/
|
|
if-no-files-found: ignore
|
|
|
|
- name: 上传绿色安装包构件
|
|
if: matrix.green_command != 'null'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.artifact_name }}-green
|
|
path: desktop-client/dist/*.zip
|
|
if-no-files-found: ignore
|
|
|
|
- name: 发布版本
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
tag_name: ${{ github.ref_name }}
|
|
name: Release ${{ github.ref_name }}
|
|
files: |
|
|
desktop-client/dist/capcut-mate-windows-x64-installer.exe
|
|
desktop-client/dist/capcut-mate-macos-arm64-installer.dmg
|
|
desktop-client/dist/capcut-mate-macos-x64-installer.dmg
|
|
desktop-client/dist/*.zip
|
|
overwrite: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |