Files
digital-me-history/.gitea/workflows/deploy.yml
T
2026-10-10 16:36:49 +08:00

54 lines
1.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: deploy-digital-me
# 推送到 main → 自动同步代码到 NAS、重新构建并重启容器
# 目标:http://192.168.110.4:8090
#
# 说明:本工作流不使用任何外部 action(如 actions/checkout),
# 直接用 Gitea 内置地址 clone,避免因访问 github.com 不稳定而失败。
on:
push:
branches: [main]
workflow_dispatch: {}
jobs:
deploy:
runs-on: ubuntu-latest
env:
TZ: Asia/Shanghai
GITEA_URL: http://192.168.110.4:3000
REPO_PATH: admin/digital-me-history
steps:
- name: 拉取代码(直接从 Gitea,不依赖 github)
run: |
set -e
git config --global --add safe.directory '*'
git clone --depth 1 "${GITEA_URL}/${REPO_PATH}.git" .
- name: 拉取 Git LFS 大文件
run: |
set -e
apt-get update -qq
apt-get install -y -qq git-lfs
git lfs install
git lfs pull
- name: 同步到 NAS 并重建容器
run: |
set -e
export TARGET_DIR=/volume1/docker/digital-me
tar czf - \
--exclude=.git \
--exclude='战役素材' \
--exclude='水墨遮罩' \
--exclude='客户成片' \
--exclude='artifacts' \
digital-me-web digital-me-backend compose.yaml \
| ssh -i /root/.ssh/nas_ci \
-o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
-o LogLevel=ERROR \
18702851751@192.168.110.4 \
"mkdir -p $TARGET_DIR && tar xzf - -C $TARGET_DIR && cd $TARGET_DIR && sudo -n /usr/local/bin/docker compose up -d --build"
echo "部署完成"