-
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
1 parent
882e887
commit dcb88ab
Showing
1 changed file
with
17 additions
and
20 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,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 "[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 |