-
Notifications
You must be signed in to change notification settings - Fork 6
163 lines (143 loc) · 4.46 KB
/
dev.yml
File metadata and controls
163 lines (143 loc) · 4.46 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Dev 分支推送构建
name: Build Dev
on:
push:
branches:
- dev
paths:
- "src/**"
- "electron/**"
- "native/**"
- "shared/**"
- "public/**"
- "package.json"
- "pnpm-lock.yaml"
- "electron-builder.config.ts"
- "electron.vite.config.ts"
- "tsconfig*.json"
- ".github/**"
workflow_dispatch:
env:
NODE_VERSION: 22.x
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
name: windows
arch: x64
artifact_name_suffix: windows-x64
package_extension: zip
build_cmd: pnpm build:win -- --x64
- os: macos-latest
name: macOS
arch: arm64
artifact_name_suffix: macos-arm64
package_extension: tar.gz
build_cmd: pnpm build:mac -- --arm64
- os: macos-latest
name: macOS
arch: x64
artifact_name_suffix: macos-x64
package_extension: tar.gz
build_cmd: pnpm build:mac -- --x64
- os: ubuntu-latest
name: linux
arch: x64
artifact_name_suffix: linux-x64
package_extension: tar.gz
build_cmd: pnpm build:linux -- --x64
steps:
- name: Check out git repository
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: "native/audio-engine -> target\nnative/media-ctrl -> 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 pkg-config clang \
rpm libarchive-tools
# 清理旧构建产物
- name: Clean workspace on Windows
if: runner.os == 'Windows'
run: |
if (Test-Path dist) { Remove-Item -Recurse -Force dist }
if (Test-Path out) { Remove-Item -Recurse -Force out }
- name: Clean workspace on macOS & Linux
if: runner.os != 'Windows'
run: rm -rf dist out
# CI 不需要国内镜像
- name: 移除 .npmrc
shell: bash
run: rm -f .npmrc
# 安装项目依赖
- name: Install dependencies
run: pnpm install
# 构建
- name: Build ${{ matrix.name }} ${{ matrix.arch }}
run: ${{ matrix.build_cmd }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_IDENTITY_AUTO_DISCOVERY: false
# 上传构建产物 (Windows)
- name: Upload Windows Setup
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: SPlayer-Next-Windows-setup-${{ matrix.arch }}
path: dist/*-setup.exe
# 上传构建产物 (macOS)
- name: Upload macOS DMG
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: SPlayer-Next-macOS-dmg-${{ matrix.arch }}
path: dist/*.dmg
- name: Upload macOS Zip
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: SPlayer-Next-macOS-zip-${{ matrix.arch }}
path: dist/*.zip
# 上传构建产物 (Linux)
- name: Upload Linux AppImage
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: SPlayer-Next-Linux-appimage-${{ matrix.arch }}
path: dist/*.AppImage
- name: Upload Linux DEB
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: SPlayer-Next-Linux-deb-${{ matrix.arch }}
path: dist/*.deb
- name: Upload Linux RPM
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: SPlayer-Next-Linux-rpm-${{ matrix.arch }}
path: dist/*.rpm
- name: Upload Linux Tar
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: SPlayer-Next-Linux-tar-${{ matrix.arch }}
path: dist/*.tar.gz