🐎 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,6 +69,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
@@ -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,21 +120,36 @@
[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` 账号
> 本程序依赖 [NeteaseCloudMusicApi](https://github.com/Binaryify/NeteaseCloudMusicApi) 运行,请确保您已成功部署该项目 3. 复制 `/.env.example` 文件并重命名为 `/.env`
4.`.env` 文件中的 `RENDERER_VITE_SERVER_URL` 改为第一步得到的 API 地址
- 请在根目录下的 `.env` 文件中的 `RENDERER_VITE_SERVER_URL` 中填入 API 地址(必需)
```js ```js
RENDERER_VITE_SERVER_URL = "your api url"; RENDERER_VITE_SERVER_URL = "https://example.com";
```
5. 将 `Build and Output Settings` 中的 `Output Directory` 改为 `out/renderer`
![build](/screenshots/build.png)
6. 点击 `Deploy`,即可成功部署
## ⚙️ 服务器部署
1. 重复 `⚙️ Vercel 部署` 中的 1 - 4 步骤
2. 克隆仓库
> 将链接中的 example/repository.git 替换为你要克隆的实际仓库的地址
```bash
git clone https://github.com/example/repository.git
``` ```
### 安装依赖 3. 安装依赖
```bash ```bash
pnpm install pnpm install
@@ -143,17 +159,7 @@ yarn install
npm install npm install
``` ```
### 开发 4. 编译打包
```bash
pnpm dev
# 或者
yarn dev
# 或者
npm dev
```
### 构建网页端
```bash ```bash
pnpm build pnpm build
@@ -163,24 +169,27 @@ yarn build
npm build npm build
``` ```
构建完成后可将生成的 `out/renderer` 文件夹内的文件上传至服务器 5. 将站点运行目录设置为 `out/renderer` 目录
若使用的为第三方部署平台,比如 `Vercel`,请将 `Build and Output Settings` 中的 `Output Directory` 改为 `out/renderer` ## ⚙️ 本地部署
![build](/screenshots/build.png) 1. 本地部署需要用到 `Node.js`。可前往 [Node.js 官网](https://nodejs.org/zh-cn/) 下载安装包,请下载最新稳定版
2. 安装 pnpm
### 构建客户端
```bash ```bash
# win npm install pnpm -g
pnpm build:win
# linux
pnpm build:linux
# mac
pnpm build:mac
``` ```
构建完成后可在 `dist` 文件夹中打开可执行文件来完成安装操作 3. 克隆仓库并拉取至本地,此处不再赘述
4. 使用 `pnpm install` 安装项目依赖(若安装过程中遇到网络错误,请使用国内镜像源替代,此处不再赘述)
5. 复制 `/.env.example` 文件并重命名为 `/.env` 并修改配置
6. 打包客户端,请依据你的系统类型来选择,打包成功后,会输出安装包或可执行文件在 `/dist` 目录中,可自行安装
| 命令 | 系统类型 |
| --- | --- |
| `pnpm build:win` | Windows |
| `pnpm build:linux` | Linux |
| `pnpm build:mac` | MacOS |
## 😘 鸣谢 ## 😘 鸣谢