Skip to content

Commit

Permalink
Renew workflow x3
Browse files Browse the repository at this point in the history
  • Loading branch information
Shanshui2024 committed Jun 26, 2024
1 parent 882e887 commit dcb88ab
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Dev 分支推送部署预览
## 仅部署 Win 端
name: 构建推送

on:
Expand All @@ -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 "[email protected]"
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
git push -f origin gh-pages

0 comments on commit dcb88ab

Please sign in to comment.