mirror of
https://github.com/imsyy/SPlayer.git
synced 2025-11-25 03:14:57 +08:00
🔧 build: 全平台采用原生架构 runner 替代交叉编译
- feat: Windows ARM64 使用 windows-11-arm 原生 runner - feat: macOS 拆分为独立的 x64 和 ARM64 构建任务 - feat: macOS x64 使用 macos-13 原生 Intel runner - feat: macOS ARM64 使用 macos-15 原生 Apple Silicon runner - feat: Linux ARM64 使用 ubuntu-22.04-arm 原生 runner - fix: 修复 Windows ARM64 交叉编译生成错误 I386 指令集问题 - improve: 移除 QEMU 和交叉编译工具链依赖 - improve: 简化构建配置,提升构建可靠性和性能 - improve: 确保所有平台生成正确架构的可执行文件
This commit is contained in:
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -62,7 +62,7 @@ jobs:
|
||||
# Windows ARM64 架构
|
||||
release-arm64:
|
||||
name: Build Electron App for Windows (ARM64)
|
||||
runs-on: windows-latest
|
||||
runs-on: windows-11-arm
|
||||
|
||||
steps:
|
||||
# 检出 Git 仓库
|
||||
|
||||
82
.github/workflows/release.yml
vendored
82
.github/workflows/release.yml
vendored
@@ -70,7 +70,7 @@ jobs:
|
||||
# Windows ARM64 架构
|
||||
build-windows-arm64:
|
||||
name: Build for Windows (ARM64)
|
||||
runs-on: windows-latest
|
||||
runs-on: windows-11-arm
|
||||
steps:
|
||||
# 检出 Git 仓库
|
||||
- name: Check out git repository
|
||||
@@ -124,10 +124,10 @@ jobs:
|
||||
dist/*.exe.blockmap
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
# macOS - 支持 Intel (x64) 和 Apple Silicon (ARM64)
|
||||
build-macos:
|
||||
name: Build for macOS (Universal)
|
||||
runs-on: macos-latest
|
||||
# macOS - 分别构建 x64 和 ARM64
|
||||
build-macos-x64:
|
||||
name: Build for macOS (Intel x64)
|
||||
runs-on: macos-13
|
||||
steps:
|
||||
# 检出 Git 仓库
|
||||
- name: Check out git repository
|
||||
@@ -154,17 +154,68 @@ jobs:
|
||||
# 清理旧的构建产物
|
||||
- name: Clean dist folder
|
||||
run: rm -rf dist
|
||||
# 构建 Electron App(同时构建 x64 和 arm64)
|
||||
- name: Build Electron App for macOS (x64 + ARM64)
|
||||
run: pnpm run build:mac || true
|
||||
# 构建 Electron App (x64)
|
||||
- name: Build Electron App for macOS x64
|
||||
run: pnpm run build:mac -- --x64 || true
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
# 上传构建产物
|
||||
- name: Upload macOS artifact
|
||||
- name: Upload macOS x64 artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: SPlayer-macOS
|
||||
name: SPlayer-macOS-x64
|
||||
if-no-files-found: ignore
|
||||
path: dist/*.*
|
||||
# 创建 GitHub Release
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
with:
|
||||
files: dist/*.*
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
|
||||
build-macos-arm64:
|
||||
name: Build for macOS (Apple Silicon ARM64)
|
||||
runs-on: macos-15
|
||||
steps:
|
||||
# 检出 Git 仓库
|
||||
- name: Check out git repository
|
||||
uses: actions/checkout@v4
|
||||
# 安装 Node.js
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22.x"
|
||||
# 安装 pnpm
|
||||
- name: Install pnpm
|
||||
run: npm install -g pnpm
|
||||
# 复制环境变量文件
|
||||
- name: Copy .env.example
|
||||
run: |
|
||||
if [ ! -f .env ]; then
|
||||
cp .env.example .env
|
||||
else
|
||||
echo ".env file already exists. Skipping the copy step."
|
||||
fi
|
||||
# 安装项目依赖
|
||||
- name: Install Dependencies
|
||||
run: pnpm install
|
||||
# 清理旧的构建产物
|
||||
- name: Clean dist folder
|
||||
run: rm -rf dist
|
||||
# 构建 Electron App (ARM64)
|
||||
- name: Build Electron App for macOS ARM64
|
||||
run: pnpm run build:mac -- --arm64 || true
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
# 上传构建产物
|
||||
- name: Upload macOS ARM64 artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: SPlayer-macOS-ARM64
|
||||
if-no-files-found: ignore
|
||||
path: dist/*.*
|
||||
# 创建 GitHub Release
|
||||
@@ -249,16 +300,11 @@ jobs:
|
||||
# Linux ARM64 架构
|
||||
build-linux-arm64:
|
||||
name: Build for Linux (ARM64)
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-22.04-arm
|
||||
steps:
|
||||
# 检出 Git 仓库
|
||||
- name: Check out git repository
|
||||
uses: actions/checkout@v4
|
||||
# 配置 QEMU 以支持 ARM64 交叉编译
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
platforms: arm64
|
||||
# 安装 Node.js
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v4
|
||||
@@ -275,9 +321,7 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get install --no-install-recommends -y rpm &&
|
||||
sudo apt-get install --no-install-recommends -y libarchive-tools &&
|
||||
sudo apt-get install --no-install-recommends -y libopenjp2-tools &&
|
||||
sudo apt-get install --no-install-recommends -y gcc-aarch64-linux-gnu &&
|
||||
sudo apt-get install --no-install-recommends -y g++-aarch64-linux-gnu
|
||||
sudo apt-get install --no-install-recommends -y libopenjp2-tools
|
||||
# 复制环境变量文件
|
||||
- name: Copy .env.example
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user