Skip to content

Renew the Workflow x2 #2

Renew the Workflow x2

Renew the Workflow x2 #2

Workflow file for this run

# Dev 分支推送部署预览
## 仅部署 Win 端
name: 构建推送
on:
push:
branches:
- main
jobs:
release:
name: 构建网站
runs-on: windows-latest
steps:
# 检出 Git 仓
- name: 签出存储库
uses: actions/[email protected]
# 安装 Node.js
- name: 安装 Node.js
uses: actions/[email protected]
with:
node-version: "18.x"
# 复制环境变量文件
- name: 复制 .env 文件
run: |
if (-not (Test-Path .env)) {
Copy-Item .env.example .env
} else {
Write-Host ".env file already exists. Skipping the copy step."
}
# 安装项目依赖
- 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
git add .
git commit -m "Deploy to Github Pages"
git push -f origin gh-pages