# CI/CD Details for ErsatzTV Fork

## Upstream GitHub Actions (to adapt for Gitea)

### Workflows
| File | Trigger | Purpose |
|------|---------|---------|
| `ci.yml` | Push to main | Version calc → docker.yml + artifacts.yml |
| `release.yml` | GitHub Release | Same but with release version tags |
| `docker.yml` | Reusable workflow | Multi-arch Docker build+push (amd64, arm32v7, arm64) |
| `artifacts.yml` | Reusable workflow | Platform binaries (macOS DMG, Windows exe, Linux) |
| `pr.yml` | Pull request | Build+test on Linux, Windows, Mac |

### What to keep for Gitea fork
- **Docker build**: Simplify to amd64-only (jazz is x86_64), push to Gitea registry or local registry
- **PR checks**: Build + test on Linux only (single runner on jazz)
- **Drop**: macOS/Windows artifacts, code signing, multi-arch, GHCR/DockerHub push

### Build Steps (from pr.yml — the test workflow)
```bash
dotnet restore
sed -i '/Scanner/d' ErsatzTV/ErsatzTV.csproj   # strip Scanner project ref
dotnet build --configuration Release --no-restore
dotnet test --blame-hang-timeout "2m" --no-restore --verbosity normal
```

### Docker Build (from docker.yml)
- Uses `docker/build-push-action@v5`
- Dockerfile: `docker/Dockerfile` (amd64), `docker/arm32v7/Dockerfile`, `docker/arm64/Dockerfile`
- Build arg: `INFO_VERSION` for version stamp
- Base image: `ghcr.io/ersatztv/ersatztv-ffmpeg:7.1.1` (custom ffmpeg)
- Needs Java in build stage (OpenAPI generator)
- Multi-stage: ffmpeg base → .NET runtime → build → final

### Image References to Update
- `jasongdove/ersatztv` → fork's registry image name
- `ghcr.io/ersatztv/ersatztv` → Gitea registry or local registry
- `ghcr.io/ersatztv/ersatztv-ffmpeg:7.1.1` — still needed as base; could mirror locally

### Gitea Actions Compatibility Notes
- Gitea Actions is GitHub Actions compatible but some actions need replacements
- `actions/checkout@v4` → works in Gitea Actions
- `actions/setup-dotnet@v4` → works in Gitea Actions
- `docker/login-action@v3` → needs Gitea registry credentials instead
- `docker/build-push-action@v5` → works but target registry changes
- `actions/upload-artifact@v4` / `download-artifact@v4` → works in Gitea Actions
- Reusable workflows (`workflow_call`) → supported in Gitea Actions

### Container Registry Options (from server-management#172)
1. **Gitea built-in** (Packages feature) — images at `192.168.1.95:3000/timothy/<package>`, needs HTTPS or `--insecure-registry`
2. **Local Docker registry** — `registry:2` on jazz at port 5000

### Runner Setup (from server-management#172)
- `gitea/act_runner:latest` container on jazz
- Needs Docker socket for DinD builds
- Register via Gitea Admin → Runners → token
- Labels: `ubuntu-latest`, `docker`
- jazz has 128GB RAM, plenty for .NET builds (2-4GB)
