From dcb88abf08777a1abb55ae68af75b3a9491525e9 Mon Sep 17 00:00:00 2001 From: Shanshui2024 Date: Wed, 26 Jun 2024 09:22:00 +0800 Subject: [PATCH] Renew workflow x3 --- .github/workflows/build.yml | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 123d64e..8c077a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,3 @@ -# Dev 分支推送部署预览 -## 仅部署 Win 端 name: 构建推送 on: @@ -10,38 +8,37 @@ on: jobs: release: name: 构建网站 - runs-on: windows-latest + runs-on: ubuntu-latest # 更改为 ubuntu-latest steps: - # 检出 Git 仓 - name: 签出存储库 - uses: actions/checkout@v4.1.1 - # 安装 Node.js + uses: actions/checkout@v2 + - name: 安装 Node.js - uses: actions/setup-node@v4.0.0 + uses: actions/setup-node@v2 with: - node-version: "18.x" - # 复制环境变量文件 + node-version: "14" # 更改为适合的 Node.js 版本 + - name: 复制 .env 文件 run: | - if (-not (Test-Path .env)) { - Copy-Item .env.example .env - } else { - Write-Host ".env file already exists. Skipping the copy step." - } - # 安装项目依赖 + if [ ! -f .env ]; then + cp .env.example .env + else + echo ".env file already exists. Skipping the copy step." + fi + - name: 安装项目依赖 run: npm install - # 构建程序 + - name: 构建网站 run: | npm run build # 如果你的项目需要进行构建 git config --global user.email "shanshui20232023@outlook.com" git config --global user.name "[AutoUpload]Shanshui" git checkout --orphan gh-pages - del /Q /S * - move dist/* . - rmdir /S /Q dist + rm -rf * + mv dist/* . + rm -rf dist git add . git commit -m "Deploy to Github Pages" - git push -f origin gh-pages \ No newline at end of file + git push -f origin gh-pages