Skip to content

Update autobuild.yml #5

Update autobuild.yml

Update autobuild.yml #5

Workflow file for this run

name: Deploy Vue App
on:
push:
branches:
- main # 监听 main 分支的提交
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: npm install
- name: Build
run: npm run build # 这会生成 docs 目录
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
- name: Copy docs to gh-pages directory
run: |
rm -rf gh-pages/*
cp -r docs/* gh-pages/
- name: Commit and push to gh-pages
working-directory: gh-pages
run: |
git config user.email "[email protected]"
git config user.name "GitHub Action"
git add .
git commit -m "Update documentation" -a || echo "No changes to commit"
git push --force origin gh-pages