43 lines
1.4 KiB
YAML
43 lines
1.4 KiB
YAML
name: 部署到群晖
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: 安装 Docker CLI
|
|
run: |
|
|
# 替换 Debian 源为清华镜像,避免国内连 deb.debian.org 超时
|
|
sed -i 's|deb.debian.org|mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list /etc/apt/sources.list.d/*.list 2>/dev/null || true
|
|
sed -i 's|security.debian.org|mirrors.tuna.tsinghua.edu.cn/debian-security|g' /etc/apt/sources.list /etc/apt/sources.list.d/*.list 2>/dev/null || true
|
|
apt-get update -qq
|
|
apt-get install -y -qq docker.io
|
|
|
|
- name: 拉取代码
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 构建镜像
|
|
run: docker build -t telegram-downloader:latest .
|
|
|
|
- name: 停止旧容器
|
|
run: |
|
|
docker stop telegram-downloader 2>/dev/null || true
|
|
docker rm telegram-downloader 2>/dev/null || true
|
|
|
|
- name: 启动新容器
|
|
run: |
|
|
docker run -d \
|
|
--name telegram-downloader \
|
|
--restart unless-stopped \
|
|
-p 15001:5001 \
|
|
-v /volume1/docker/apps/telegram-downloader/appdata:/app/appdata \
|
|
-v /volume2/save/tgdowload:/app/downloads \
|
|
telegram-downloader:latest
|
|
|
|
- name: 部署完成提示
|
|
run: |
|
|
echo "✅ 部署完成,浏览器访问 http://192.168.1.66:15001 查看"
|