🐎 ci: 修复构建失败

This commit is contained in:
imsyy
2023-12-15 11:16:37 +08:00
parent eaaeb0f5d3
commit 354d271582
3 changed files with 67 additions and 46 deletions

View File

@@ -21,6 +21,9 @@ jobs:
uses: actions/setup-node@v4.0.0 uses: actions/setup-node@v4.0.0
with: with:
node-version: "18.x" node-version: "18.x"
# 复制环境变量文件
- name: Copy .env.example
run: cp .env.example .env
# 安装项目依赖 # 安装项目依赖
- name: Install Dependencies - name: Install Dependencies
run: npm install run: npm install

View File

@@ -21,6 +21,9 @@ jobs:
uses: actions/setup-node@v4.0.0 uses: actions/setup-node@v4.0.0
with: with:
node-version: "18.x" node-version: "18.x"
# 复制环境变量文件
- name: Copy .env.example
run: cp .env.example .env
# 安装项目依赖 # 安装项目依赖
- name: Install Dependencies - name: Install Dependencies
run: npm install run: npm install
@@ -66,7 +69,10 @@ jobs:
uses: actions/setup-node@v4.0.0 uses: actions/setup-node@v4.0.0
with: with:
node-version: "18.x" node-version: "18.x"
# 安装项目依赖 # 复制环境变量文件
- name: Copy .env.example
run: cp .env.example .env
# 安装项目依赖
- name: Install Dependencies - name: Install Dependencies
run: npm install run: npm install
# 构建 Electron App # 构建 Electron App
@@ -114,6 +120,9 @@ jobs:
# 更新 Ubuntu 软件源 # 更新 Ubuntu 软件源
- name: Ubuntu Update with sudo - name: Ubuntu Update with sudo
run: sudo apt-get update run: sudo apt-get update
# 复制环境变量文件
- name: Copy .env.example
run: cp .env.example .env
# 安装项目依赖 # 安装项目依赖
- name: Install Dependencies - name: Install Dependencies
run: npm install run: npm install

View File

@@ -1,4 +1,5 @@
> [!IMPORTANT] > [!IMPORTANT]
>
> ## 严肃警告 > ## 严肃警告
> >
> - 请务必遵守 [GNU Affero General Public License (AGPL-3.0)](https://www.gnu.org/licenses/agpl-3.0.html) 许可协议 > - 请务必遵守 [GNU Affero General Public License (AGPL-3.0)](https://www.gnu.org/licenses/agpl-3.0.html) 许可协议
@@ -119,68 +120,76 @@
[Dev Workflow](https://github.com/imsyy/SPlayer/actions/workflows/build.yml) [Dev Workflow](https://github.com/imsyy/SPlayer/actions/workflows/build.yml)
## ⚙️ 部署 ## ⚙️ Vercel 部署
> Vercel 等托管平台可在 Fork 后一键导入并自动部署 > 其他部署平台大致相同,在此不做说明
### API 服务(客户端无需理会,如果需要网页端,则必需部署) 1. 本程序依赖 [NeteaseCloudMusicApi](https://github.com/Binaryify/NeteaseCloudMusicApi) 运行,请确保您已成功部署该项目,并成功取得在线访问地址
2. 点击本仓库右上角的 `Fork`,复制本仓库到你的 `GitHub` 账号
3. 复制 `/.env.example` 文件并重命名为 `/.env`
4.`.env` 文件中的 `RENDERER_VITE_SERVER_URL` 改为第一步得到的 API 地址
> 本程序依赖 [NeteaseCloudMusicApi](https://github.com/Binaryify/NeteaseCloudMusicApi) 运行,请确保您已成功部署该项目 ```js
RENDERER_VITE_SERVER_URL = "https://example.com";
```
5. 将 `Build and Output Settings` 中的 `Output Directory` 改为 `out/renderer`
- 请在根目录下的 `.env` 文件中的 `RENDERER_VITE_SERVER_URL` 中填入 API 地址(必需) ![build](/screenshots/build.png)
```js 6. 点击 `Deploy`,即可成功部署
RENDERER_VITE_SERVER_URL = "your api url";
```
### 安装依赖 ## ⚙️ 服务器部署
```bash 1. 重复 `⚙️ Vercel 部署` 中的 1 - 4 步骤
pnpm install 2. 克隆仓库
# 或者
yarn install
# 或者
npm install
```
### 开发 > 将链接中的 example/repository.git 替换为你要克隆的实际仓库的地址
```bash ```bash
pnpm dev git clone https://github.com/example/repository.git
# 或者 ```
yarn dev
# 或者
npm dev
```
### 构建网页端 3. 安装依赖
```bash ```bash
pnpm build pnpm install
# 或者 # 或者
yarn build yarn install
# 或者 # 或者
npm build npm install
``` ```
构建完成后可将生成的 `out/renderer` 文件夹内的文件上传至服务器 4. 编译打包
若使用的为第三方部署平台,比如 `Vercel`,请将 `Build and Output Settings` 中的 `Output Directory` 改为 `out/renderer` ```bash
pnpm build
# 或者
yarn build
# 或者
npm build
```
![build](/screenshots/build.png) 5. 将站点运行目录设置为 `out/renderer` 目录
### 构建客户端 ## ⚙️ 本地部署
```bash 1. 本地部署需要用到 `Node.js`。可前往 [Node.js 官网](https://nodejs.org/zh-cn/) 下载安装包,请下载最新稳定版
# win 2. 安装 pnpm
pnpm build:win
# linux
pnpm build:linux
# mac
pnpm build:mac
```
构建完成后可在 `dist` 文件夹中打开可执行文件来完成安装操作 ```bash
npm install pnpm -g
```
3. 克隆仓库并拉取至本地,此处不再赘述
4. 使用 `pnpm install` 安装项目依赖(若安装过程中遇到网络错误,请使用国内镜像源替代,此处不再赘述)
5. 复制 `/.env.example` 文件并重命名为 `/.env` 并修改配置
6. 打包客户端,请依据你的系统类型来选择,打包成功后,会输出安装包或可执行文件在 `/dist` 目录中,可自行安装
| 命令 | 系统类型 |
| --- | --- |
| `pnpm build:win` | Windows |
| `pnpm build:linux` | Linux |
| `pnpm build:mac` | MacOS |
## 😘 鸣谢 ## 😘 鸣谢