Merge branch 'wuxichen' of http://gitea.tashowz.com/tashow/tashow-manager into wuxichen
All checks were successful
Auto Deploy / build-and-deploy (push) Successful in 31s
All checks were successful
Auto Deploy / build-and-deploy (push) Successful in 31s
This commit is contained in:
46
.gitea/workflows/deploy.yml
Normal file
46
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
name: Auto Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- wuxichen # 当前分支
|
||||
- main
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: self-hosted
|
||||
|
||||
steps:
|
||||
- name: Build and Deploy
|
||||
run: |
|
||||
# 使用持久化工作目录,避免每次重新克隆
|
||||
WORK_DIR="/root/tashow-deploy"
|
||||
|
||||
# 首次运行时克隆代码
|
||||
if [ ! -d "$WORK_DIR" ]; then
|
||||
echo "首次部署,克隆代码..."
|
||||
git clone http://gitea.tashowz.com/tashow/tashow-manager.git $WORK_DIR
|
||||
fi
|
||||
|
||||
cd $WORK_DIR
|
||||
|
||||
# 更新代码到最新版本
|
||||
echo "更新代码..."
|
||||
git fetch origin
|
||||
git checkout ${{ github.ref_name }}
|
||||
git reset --hard origin/${{ github.ref_name }}
|
||||
|
||||
# 安装依赖
|
||||
echo "安装依赖..."
|
||||
pnpm install
|
||||
|
||||
# 构建项目
|
||||
echo "构建项目..."
|
||||
pnpm build
|
||||
|
||||
# 部署到服务器
|
||||
echo "部署到服务器..."
|
||||
rsync -av --delete dist/ /home/1panel/www/sites/admin.petshy.tashowz.com/index/
|
||||
|
||||
echo "部署成功!"
|
||||
2
public/test.txt
Normal file
2
public/test.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
CI/CD Test - Deployed at 2026-03-02 16:23
|
||||
This file is used to verify automatic deployment is working.
|
||||
Reference in New Issue
Block a user