Skip to content

update test

update test #18

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 source code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 获取完整历史记录
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*' # 使用LTS版本
check-latest: true # 确保使用最新版本
cache-dependency-path: 'pnpm-lock.yaml'
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install
- name: Build project
run: pnpm build
- name: Checkout target branch
uses: actions/checkout@v4
with:
ref: web-build # 目标分支名称
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Copy build files
run: |
mkdir -p dist
cp -R ./dist/* ../dist/
- name: Commit and push build files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add dist/
git commit -m "Deploy build files" || echo "No changes to commit"
git push origin web-build
- name: Clean up
run: |
git clean -fd