Renew workflow x3 #3
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
name: 构建推送 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
name: 构建网站 | |
runs-on: ubuntu-latest # 更改为 ubuntu-latest | |
steps: | |
- name: 签出存储库 | |
uses: actions/checkout@v2 | |
- name: 安装 Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "14" # 更改为适合的 Node.js 版本 | |
- name: 复制 .env 文件 | |
run: | | |
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 | |
rm -rf * | |
mv dist/* . | |
rm -rf dist | |
git add . | |
git commit -m "Deploy to Github Pages" | |
git push -f origin gh-pages |