livetv/.forgejo/workflows/deploy.yaml
Заид Омар Медхат 9c03ade41f
All checks were successful
Deploy / deploy (push) Successful in 7m39s
fix ci
2026-07-25 22:09:26 +05:00

66 lines
2.7 KiB
YAML

name: Deploy
# Deploy on every push to master (and allow manual runs from the Actions tab).
on:
push:
branches: [master]
workflow_dispatch:
# A STABLE compose project name so the named volume (dispatcharr_data) is the
# same on every run. Compose prefixes volumes with the project name; if that
# name changed between runs (e.g. a different checkout path) you'd silently get
# a fresh empty volume and lose Dispatcharr's database/config on each deploy.
env:
COMPOSE_PROJECT_NAME: livetv
jobs:
deploy:
# `docker` label => node:22-bookworm with the host Docker socket available.
runs-on: docker
steps:
- name: Checkout
uses: actions/checkout@v4
# The job image has the Docker socket available but may not ship the docker
# CLI / compose plugin. Install them only if missing (no-op otherwise) so
# `docker compose ...` can talk to the host daemon.
- name: Ensure Docker CLI + Compose plugin
run: |
if ! command -v docker >/dev/null 2>&1; then
curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-27.3.1.tgz \
| tar -xz -C /usr/local/bin --strip-components=1 docker/docker
fi
if ! docker compose version >/dev/null 2>&1; then
mkdir -p /usr/local/lib/docker/cli-plugins
curl -fsSL https://github.com/docker/compose/releases/download/v2.29.7/docker-compose-linux-x86_64 \
-o /usr/local/lib/docker/cli-plugins/docker-compose
chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
fi
docker version
docker compose version
# `proxy` is the shared external network Nginx Proxy Manager sits on.
# Create it if it doesn't exist yet so `docker compose up` won't fail.
- name: Ensure 'proxy' network exists
run: docker network inspect proxy >/dev/null 2>&1 || docker network create proxy
# Pull the latest images. Large images over a flaky path (e.g. IPv6 to the
# GHCR CDN) can drop mid-transfer, so retry a few times before giving up.
- name: Pull images
run: |
for i in 1 2 3 4 5; do
docker compose pull && exit 0
echo "pull attempt $i failed; retrying in 15s..."
sleep 15
done
echo "pull failed after 5 attempts" >&2
exit 1
# Reconcile the stack: compose only recreates services whose config or
# image actually changed, and cleans up any services removed from the file.
- name: Deploy stack
run: docker compose up -d --remove-orphans
# Free disk on the shared runner by dropping old, untagged images.
- name: Prune old images
run: docker image prune -f