diff --git a/.gitea/workflows/ci-cd.yml b/.gitea/workflows/ci-cd.yml index 6020c5d..a952dab 100644 --- a/.gitea/workflows/ci-cd.yml +++ b/.gitea/workflows/ci-cd.yml @@ -56,7 +56,7 @@ jobs: working-directory: DrSousan.Api run: dotnet build DrSousan.Api.csproj --no-restore -c Release - # ── CD: build image → push to Nexus → deploy (push to main only) ──────────── + # ── CD: build image → deploy locally (push to main only) ─────────────────── deploy: name: "Deploy · drsousan" runs-on: self-hosted @@ -109,6 +109,12 @@ jobs: if: always() run: docker compose ps - - name: Prune old images + - name: Prune old drsousan images if: success() - run: docker image prune -f + # Only remove untagged (dangling) drsousan images — never touches other projects + run: | + docker images --format '{{.Repository}}:{{.Tag}} {{.ID}}' \ + | grep '^mirror\.soroushasadi\.com/drsousan/' \ + | grep '' \ + | awk '{print $2}' \ + | xargs -r docker rmi || true