fix: 修复工作流 & builder 配置

This commit is contained in:
imsyy
2023-11-29 17:03:51 +08:00
parent e82ffe8683
commit dc119654a2
6 changed files with 174 additions and 98 deletions

View File

@@ -14,6 +14,12 @@ body:
attributes: attributes:
label: "当前系统环境" label: "当前系统环境"
placeholder: "win11" placeholder: "win11"
- type: input
validations:
required: true
attributes:
label: "当前 Node.js 及 npm 版本"
placeholder: "v18.16.0 / v9.6.7"
- type: input - type: input
validations: validations:
required: true required: true

View File

@@ -1,3 +1,5 @@
# Dev 分支推送部署预览
## 仅部署 Win 端
name: Build Dev name: Build Dev
on: on:
@@ -11,35 +13,29 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
# 检出 Git 仓库
- name: Check out git repository - name: Check out git repository
uses: actions/checkout@v3.0.0 uses: actions/checkout@v4.1.1
# 安装 Node.js
- name: Install Node.js - name: Install Node.js
uses: actions/setup-node@v3.0.0 uses: actions/setup-node@v4.0.0
with: with:
node-version: "16.x" node-version: "18.x"
# 安装项目依赖
- name: Install Dependencies - name: Install Dependencies
run: npm install run: npm install
# 构建 Electron App
- name: Build Electron App - name: Build Electron App
run: npm run build:win run: npm run build:win
env: env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# 清理不必要的构建产物
- name: Cleanup Artifacts - name: Cleanup Artifacts
run: | run: |
npx rimraf "dist/!(*.exe)" npx rimraf "dist/!(*.exe)"
# 上传构建产物
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v3.0.0 uses: actions/upload-artifact@v3.1.3
with: with:
name: SPlayer-dev name: SPlayer-dev
path: dist path: dist
- name: Create a release
uses: softprops/action-gh-release@v0.1.14
if: startsWith(github.ref, 'refs/tags/v')
with:
draft: true
files: "dist/**"

View File

@@ -1,3 +1,5 @@
# Release 发行版本部署
## 多端部署
name: Build Release name: Build Release
on: on:
@@ -6,95 +8,134 @@ on:
- v* - v*
jobs: jobs:
# Windows
build-windows: build-windows:
name: Build for Windows name: Build for Windows
runs-on: windows-latest runs-on: windows-latest
steps: steps:
# 检出 Git 仓库
- name: Check out git repository - name: Check out git repository
uses: actions/checkout@v3.0.0 uses: actions/checkout@v4.1.1
# 安装 Node.js
- name: Install Node.js - name: Install Node.js
uses: actions/setup-node@v3.0.0 uses: actions/setup-node@v4.0.0
with: with:
node-version: "16.x" node-version: "18.x"
# 安装项目依赖
- name: Install Dependencies - name: Install Dependencies
run: npm install run: npm install
# 构建 Electron App
- name: Build Electron App for Windows - name: Build Electron App for Windows
run: npm run build:win run: npm run build:win || true
shell: bash
env: env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# 上传构建产物
- name: Upload Windows artifact - name: Upload Windows artifact
uses: actions/upload-artifact@v3.0.0 uses: actions/upload-artifact@v3.1.3
with: with:
name: SPlayer-Windows name: SPlarer-Win
path: dist/*.exe if-no-files-found: ignore
path: |
dist/*.exe
dist/*.msi
# 创建 GitHub Release
- name: Release
uses: softprops/action-gh-release@v0.1.14
if: startsWith(github.ref, 'refs/tags/v')
with:
draft: true
files: |
dist/*.exe
dist/*.msi
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# Mac
build-macos: build-macos:
name: Build for macOS name: Build for macOS
runs-on: macos-latest runs-on: macos-latest
steps: steps:
# 检出 Git 仓库
- name: Check out git repository - name: Check out git repository
uses: actions/checkout@v3.0.0 uses: actions/checkout@v4.1.1
# 安装 Node.js
- name: Install Node.js - name: Install Node.js
uses: actions/setup-node@v3.0.0 uses: actions/setup-node@v4.0.0
with: with:
node-version: "16.x" node-version: "18.x"
# 安装项目依赖
- name: Install Dependencies - name: Install Dependencies
run: npm install run: npm install
# 构建 Electron App
- name: Build Electron App for macOS - name: Build Electron App for macOS
run: npm run build:mac run: npm run build:mac || true
shell: bash
env: env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# 上传构建产物
- name: Upload macOS artifact - name: Upload macOS artifact
uses: actions/upload-artifact@v3.0.0 uses: actions/upload-artifact@v3.1.3
with: with:
name: SPlayer-macOS name: SPlarer-Macos
path: dist/*.dmg if-no-files-found: ignore
path: |
build-linux: dist/*.dmg
name: Build for Linux dist/*.zip
runs-on: ubuntu-latest # 创建 GitHub Release
steps: - name: Release
- name: Check out git repository uses: softprops/action-gh-release@v0.1.14
uses: actions/checkout@v3.0.0 if: startsWith(github.ref, 'refs/tags/v')
- name: Install Node.js
uses: actions/setup-node@v3.0.0
with:
node-version: "16.x"
- name: Install Dependencies
run: npm install
- name: Build Electron App for Linux
run: npm run build:linux
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Upload Linux artifact
uses: actions/upload-artifact@v3.0.0
with:
name: SPlayer-Linux
path: dist/*.AppImage
create-release:
needs: [build-windows, build-macos, build-linux]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3.0.0
- name: Create a release
uses: softprops/action-gh-release@v1
with: with:
draft: true draft: true
files: "dist/**" files: |
dist/*.dmg
dist/*.zip
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# Linux
build-linux:
name: Build for Linux
runs-on: ubuntu-22.04
steps:
# 检出 Git 仓库
- name: Check out git repository
uses: actions/checkout@v4.1.1
# 安装 Node.js
- name: Install Node.js
uses: actions/setup-node@v4.0.0
with:
node-version: "18.x"
# 更新 Ubuntu 软件源
- name: Ubuntu Update with sudo
run: sudo apt-get update
# 安装项目依赖
- name: Install Dependencies
run: npm install
# 构建 Electron App
- name: Build Electron App for Linux
run: npm run build:linux || true
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# 上传构建产物
- name: Upload Linux artifact
uses: actions/upload-artifact@v3.1.3
with:
name: SPlarer-Linux
if-no-files-found: ignore
path: |
dist/*.AppImage
dist/*.deb
dist/*.rpm
# 创建 GitHub Release
- name: Release
uses: softprops/action-gh-release@v0.1.14
if: startsWith(github.ref, 'refs/tags/v')
with:
draft: true
files: |
dist/*.AppImage
dist/*.deb
dist/*.rpm
env: env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}

View File

@@ -1,3 +1,11 @@
> [!IMPORTANT]
> ## 🎉 当前项目正在重构中 🎉
>
> - 目前版本进入维护模式,仅在遇到重大问题时会进行修复
> - 支持客户端与网页端
> - 支持现有版本所有功能
> - 新增支持播放与管理本地歌曲
<div align="center"> <div align="center">
<img alt="logo" height="80" src="./public/images/logo/favicon.png" /> <img alt="logo" height="80" src="./public/images/logo/favicon.png" />
<h2>SPlayer</h2> <h2>SPlayer</h2>
@@ -8,11 +16,6 @@
## 说明 ## 说明
> **当前项目正在重构中,目前版本进入维护模式,仅在遇到重大问题时会进行修复**
> - 支持客户端与网页端
> - 支持现有版本所有功能
> - 新增支持播放与管理本地歌曲
>
- 本项目采用 [Vue 3](https://cn.vuejs.org/) 全家桶和 [Naïve UI](https://www.naiveui.com/) 组件库及 [Electron](https://www.electronjs.org/zh/docs/latest/) 开发 - 本项目采用 [Vue 3](https://cn.vuejs.org/) 全家桶和 [Naïve UI](https://www.naiveui.com/) 组件库及 [Electron](https://www.electronjs.org/zh/docs/latest/) 开发
- 支持网页端与客户端,由于设备有限,目前仅适配 `Win`,其他平台可自行构建 - 支持网页端与客户端,由于设备有限,目前仅适配 `Win`,其他平台可自行构建
- ~~仅对移动端做了基础适配,**不保证功能全部可用**~~ - ~~仅对移动端做了基础适配,**不保证功能全部可用**~~
@@ -57,7 +60,7 @@
- [ ] 多种布局方式 - [ ] 多种布局方式
- [ ] 发表评论 - [ ] 发表评论
## 😍 Screenshots ## 🖼️ Screenshots
> 开发中,仅供参考 > 开发中,仅供参考
@@ -103,6 +106,18 @@
</details> </details>
## 📦️ 获取
### 稳定版
通常情况下,可以在 [Releases](https://github.com/imsyy/SPlayer/releases) 中获取稳定版
### 开发版
可以通过 `GitHub Actions` 工作流获取最新的开发版,目前开发版仅提供 `Win` 版本
[Dev Workflow](https://github.com/imsyy/SPlayer/actions/workflows/build.yml)
## ⚙️ 部署 ## ⚙️ 部署
> Vercel 等托管平台可在 Fork 后一键导入并自动部署 > Vercel 等托管平台可在 Fork 后一键导入并自动部署
@@ -179,12 +194,21 @@ pnpm build:mac
## 📜 开源许可 ## 📜 开源许可
- **本项目仅供个人学习研究使用,禁止用于商业及非法用途** - **本项目仅供个人学习研究使用,禁止用于商业及非法用途**
- 本项目基于 [MIT license](https://opensource.org/license/mit/) 许可进行开源 - 本项目基于 [GNU General Public License version 3](https://opensource.org/license/gpl-3-0/) 许可进行开源
1. **修改和分发:** 任何对本项目的修改和分发都必须基于 GPL Version 3 进行,源代码必须一并提供
2. **派生作品:** 任何派生作品必须同样采用 GPL Version 3并在适当的地方注明原始项目的许可证
3. **免责声明:** 根据 GPL Version 3本项目不提供任何明示或暗示的担保。请详细阅读 GPL Version 3以了解完整的免责声明内容
4. **社区参与:** 欢迎社区的参与和贡献,我们鼓励开发者一同改进和维护本项目
5. **许可证链接:** 请阅读 [GNU General Public License version 3](https://opensource.org/license/gpl-3-0/) 了解更多详情
## 📢 免责声明 ## 📢 免责声明
本项目使用了网易云音乐的第三方 API 服务,**仅供个人学习研究使用,禁止用于商业及非法用途** 本项目旨在提供一个前端练手的实战项目,用于帮助开发者提升技能水平和对前端技术的理解 本项目部分功能使用了网易云音乐的第三方 API 服务,**仅供个人学习研究使用,禁止用于商业及非法用途**
同时,本项目开发者承诺 **严格遵守相关法律法规和网易云音乐 API 使用协议,不会利用本项目进行任何违法活动。** 如因使用本项目而引起的任何纠纷或责任,均由使用者自行承担。**本项目开发者不承担任何因使用本项目而导致的任何直接或间接责任,并保留追究使用者违法行为的权利** 同时,本项目开发者承诺 **严格遵守相关法律法规和网易云音乐 API 使用协议,不会利用本项目进行任何违法活动。** 如因使用本项目而引起的任何纠纷或责任,均由使用者自行承担。**本项目开发者不承担任何因使用本项目而导致的任何直接或间接责任,并保留追究使用者违法行为的权利**
请使用者在使用本项目时遵守相关法律法规,**不要将本项目用于任何商业及非法用途。如有违反,一切后果由使用者自负。** 同时,使用者应该自行承担因使用本项目而带来的风险和责任。本项目开发者不对本项目所提供的服务和内容做出任何保证 请使用者在使用本项目时遵守相关法律法规,**不要将本项目用于任何商业及非法用途。如有违反,一切后果由使用者自负。** 同时,使用者应该自行承担因使用本项目而带来的风险和责任。本项目开发者不对本项目所提供的服务和内容做出任何保证
**任何未经授权的商业用途,以及对网易云音乐 API 使用协议的违反,将导致对用户采取法律行动的可能性**
感谢您的理解与合作

View File

@@ -1,11 +1,11 @@
# 应用程序的唯一标识符 # 应用程序的唯一标识符
appId: com.imsyy.splayer appId: com.imsyy.splayer
# 应用程序的产品名称 # 应用程序的产品名称
productName: SPlayer-desktop productName: SPlayer
copyright: 'Copyright © imsyy 2023' copyright: Copyright © imsyy 2023
# 构建资源所在的目录 # 构建资源所在的目录
directories: directories:
buildResources: public buildResources: build
# 包含在最终应用程序构建中的文件列表,这里使用通配符 ! 表示排除不需要的文件 # 包含在最终应用程序构建中的文件列表,这里使用通配符 ! 表示排除不需要的文件
files: files:
- "!**/.vscode/*" - "!**/.vscode/*"
@@ -22,8 +22,11 @@ win:
executableName: splayer-desktop executableName: splayer-desktop
# 应用程序的图标文件路径 # 应用程序的图标文件路径
icon: public/images/logo/favicon_256.png icon: public/images/logo/favicon_256.png
# 构建的目标类型 # 构建类型
# target: "portable" target:
- nsis
- portable
# 管理员权限
requestedExecutionLevel: highestAvailable requestedExecutionLevel: highestAvailable
# NSIS 安装器配置 # NSIS 安装器配置
nsis: nsis:
@@ -43,6 +46,10 @@ nsis:
allowToChangeInstallationDirectory: true allowToChangeInstallationDirectory: true
# macOS 平台配置 # macOS 平台配置
mac: mac:
# 可执行文件名
executableName: splayer-desktop
# 应用程序的图标文件路径
icon: public/images/logo/favicon_256.png
# 权限继承的文件路径 # 权限继承的文件路径
entitlementsInherit: build/entitlements.mac.plist entitlementsInherit: build/entitlements.mac.plist
# 扩展信息,如权限描述 # 扩展信息,如权限描述
@@ -61,9 +68,14 @@ dmg:
artifactName: ${productName}-${version}.${ext} artifactName: ${productName}-${version}.${ext}
# Linux 平台配置 # Linux 平台配置
linux: linux:
# 目标平台,例如 AppImage、snap、deb 等 # 可执行文件名
executableName: splayer-desktop
# 应用程序的图标文件路径
icon: public/images/logo/favicon_256.png
# 构建类型
target: target:
- AppImage - AppImage
- portable
- snap - snap
- deb - deb
- rpm - rpm
@@ -85,4 +97,4 @@ publish:
# 自动更新检查的 URL # 自动更新检查的 URL
# url: https://example.com/auto-updates # url: https://example.com/auto-updates
owner: "imsyy" owner: "imsyy"
repo: "splayer" repo: "SPlayer"

View File

@@ -1,5 +1,5 @@
import { join } from "path"; import { join } from "path";
import { app, protocol, shell, BrowserWindow, globalShortcut } from "electron"; import { app, shell, BrowserWindow, globalShortcut } from "electron";
import { electronApp, optimizer, is } from "@electron-toolkit/utils"; import { electronApp, optimizer, is } from "@electron-toolkit/utils";
import { startNcmServer } from "@main/startNcmServer"; import { startNcmServer } from "@main/startNcmServer";
import { startMainServer } from "@main/startMainServer"; import { startMainServer } from "@main/startMainServer";
@@ -18,11 +18,6 @@ process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "true";
// 单例锁 // 单例锁
const gotTheLock = app.requestSingleInstanceLock(); const gotTheLock = app.requestSingleInstanceLock();
// 注册自定义协议
protocol.registerSchemesAsPrivileged([
{ scheme: "imsyy-splayer", privileges: { standard: true, secure: true } },
]);
// 配置 log // 配置 log
log.transports.file.resolvePathFn = () => log.transports.file.resolvePathFn = () =>
join(app.getPath("documents"), "/SPlayer/splayer-log.txt"); join(app.getPath("documents"), "/SPlayer/splayer-log.txt");
@@ -98,6 +93,9 @@ app.whenReady().then(async () => {
return false; return false;
} }
// 注册应用协议
app.setAsDefaultProtocolClient("splayer");
// 初始化完成并准备创建浏览器窗口 // 初始化完成并准备创建浏览器窗口
// 为 Windows 设置应用程序用户模型 ID // 为 Windows 设置应用程序用户模型 ID
electronApp.setAppUserModelId("com.electron"); electronApp.setAppUserModelId("com.electron");
@@ -120,7 +118,6 @@ app.whenReady().then(async () => {
// 自定义协议 // 自定义协议
app.on("open-url", (_, url) => { app.on("open-url", (_, url) => {
// 在这里处理自定义协议的事件,比如打开相应的窗口或执行其他操作
console.log("Received custom protocol URL:", url); console.log("Received custom protocol URL:", url);
}); });