43 lines
872 B
YAML
43 lines
872 B
YAML
name: Auto Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- wuxichen # 当前分支
|
|
- main
|
|
- master
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 8
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
|
|
- name: Build project
|
|
run: pnpm build
|
|
|
|
- name: Deploy to server
|
|
uses: appleboy/scp-action@master
|
|
with:
|
|
host: ${{ secrets.SSH_HOST }}
|
|
username: ${{ secrets.SSH_USER }}
|
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
source: "dist/*"
|
|
target: ${{ secrets.DEPLOY_PATH }}
|
|
strip_components: 1
|