Skip to content

Regular upload

Regular upload #20

Workflow file for this run

name: ci
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '21.6.1' # 或者你需要的其他版本
- name: Install dependencies
run: npm install
- name: Run Webpack build
run: npm run produce # 运行你在 package.json 中定义的生产打包命令
- name: List public directory
run: ls -R public || echo "public directory does not exist"
- name: Deploy to GitHub Pages
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git checkout gh-pages || git checkout --orphan gh-pages
rm -rf *
if [ -d public ]; then
cp -R public/* .
else
echo "public directory does not exist"
exit 1
fi
git add .
git commit -m "Deploy to GitHub Pages" || echo "No changes to commit"
git push origin gh-pages
# - name: Clean public folder
# run: rm -rf ./public/* # 删除 public 文件夹中的所有内容
# - name: Copy build output to public folder
# run: cp -R ./dist/* ./public/ # 假设打包输出在 dist 文件夹
# - name: Deploy to GitHub Pages
# run: npm run gh-pages
# 这里替换为你的部署命令