feat: add action
This commit is contained in:
35
github/workflows/deploy.yml
Normal file
35
github/workflows/deploy.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: 构建并部署前端项目
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["master"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 拉取代码
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 安装Bun
|
||||||
|
uses: oven-sh/setup-bun@v1
|
||||||
|
with:
|
||||||
|
bun-version: latest
|
||||||
|
|
||||||
|
- name: 安装依赖
|
||||||
|
run: bun install
|
||||||
|
|
||||||
|
- name: 构建项目
|
||||||
|
run: bun run build
|
||||||
|
|
||||||
|
- name: 部署到服务器
|
||||||
|
uses: appleboy/scp-action@master
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.SERVER_HOST }}
|
||||||
|
port: 22
|
||||||
|
username: ${{ secrets.SERVER_USER }}
|
||||||
|
password: ${{ secrets.SERVER_PASSWORD }}
|
||||||
|
source: "dist/*"
|
||||||
|
target: ${{ secrets.SERVER_TARGET_DIR }}
|
||||||
|
rm: true
|
||||||
Reference in New Issue
Block a user