Repository navigation
137 lines (122 loc) · 3.44 KB
/
Copy pathdev.yml
File metadata and controls
137 lines (122 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Dev 分支推送构建
name: Build Dev
on:
push:
branches:
- dev
paths:
- "src/**"
- "electron/**"
- "native/**"
- "shared/**"
- "public/**"
- "resources/**"
- "scripts/**"
- "package.json"
- "pnpm-lock.yaml"
- "electron-builder.config.ts"
- "electron.vite.config.ts"
- "tsconfig*.json"
- ".github/workflows/dev.yml"
workflow_dispatch:
concurrency:
group: dev-build-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: 24.x
jobs:
build:
name: Build on ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- name: Windows x64
runner: windows-latest
target: windows-x64
- name: macOS arm64
runner: macos-latest
target: macos-arm64
- name: Linux x64
runner: ubuntu-latest
target: linux-x64
steps:
- name: Check out git repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: ". -> target"
# Linux: 安装系统构建/打包依赖
- name: 安装系统依赖 (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y \
libasound2-dev libdbus-1-dev libpipewire-0.3-dev libpulse-dev pkg-config clang \
rpm libarchive-tools
# 清理旧构建产物
- name: Clean workspace
shell: bash
run: rm -rf dist out
# CI 不需要国内镜像
- name: 移除 .npmrc
shell: bash
run: rm -f .npmrc
# 安装项目依赖
- name: Install dependencies
run: pnpm install --frozen-lockfile
# 注入 -dev 版本号,使其低于同基准的 Nightly,可通过 Nightly 通道更新
- name: Generate Dev Version
shell: bash
run: node scripts/gen-version.cjs dev
# 构建各平台代表性产物
- name: Build ${{ matrix.name }}
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UPDATE_CHANNEL: nightly
CSC_IDENTITY_AUTO_DISCOVERY: false
run: |
case "${{ matrix.target }}" in
windows-x64)
pnpm build:win --x64 --publish never
;;
macos-arm64)
pnpm build:mac --arm64 --publish never
;;
linux-x64)
pnpm build:linux --x64 --publish never
;;
*)
echo "Unsupported target: ${{ matrix.target }}"
exit 1
;;
esac
# 上传当前平台的安装包产物
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: SPlayer-Next-${{ matrix.target }}
path: |
dist/*.exe
dist/*.dmg
dist/*.zip
dist/*.AppImage
dist/*.deb
dist/*.rpm
dist/*.tar.gz
dist/*.pacman
if-no-files-found: ignore