-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,49 @@ | ||
name: Build and Deploy | ||
on: # 监听 main 分支上的 push 事件 | ||
|
||
on: | ||
push: | ||
branches: | ||
- feat/taskList | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest # 构建环境使用 ubuntu | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Install and Build # 下载依赖 打包项目 | ||
# 安装 Node.js 和 pnpm | ||
- name: Install Node.js 22.7 | ||
run: | | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash | ||
source ~/.nvm/nvm.sh | ||
nvm install 22.7 | ||
nvm use 22.7 | ||
node -v # 验证 Node 版本 | ||
- name: Install pnpm 9.9 | ||
run: | | ||
npm install -g pnpm | ||
pnpm install --frozen-lockfile # 确保使用锁文件安装 | ||
pnpm run build | ||
npm install -g [email protected] | ||
pnpm -v # 验证 pnpm 版本 | ||
- name: List files in src | ||
run: ls -R src # 输出 src 目录中的文件,调试用 | ||
# 安装依赖并构建项目 | ||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Build project | ||
run: pnpm build | ||
|
||
# 调试:列出 src 目录结构 | ||
- name: List files in src directory | ||
run: ls -R src | ||
|
||
# 静态文件压缩 | ||
- name: pack out file | ||
- name: Pack output files | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
run: tar -zcvf out.tgz dist | ||
|
||
# 清理缓存(可选步骤) | ||
- name: Clean pnpm cache | ||
run: pnpm store prune |