44 lines
1.4 KiB
YAML
44 lines
1.4 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
# Runs on the forgerunner host: bundled Docker CLI + mounted /var/run/docker.sock.
|
|
runs-on: host
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: registry.alwisp.com
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Build and Push
|
|
run: |
|
|
# gitea.repository is already "owner/repo" (e.g. jason/breedr).
|
|
IMAGE="registry.alwisp.com/${{ gitea.repository }}"
|
|
docker build -t "${IMAGE}:latest" .
|
|
docker push "${IMAGE}:latest"
|
|
|
|
# Dangling-only prune: removes untagged leftovers from previous builds.
|
|
# Never removes the tagged :latest (kept for the Unraid deployment) or
|
|
# any image referenced by a container.
|
|
- name: Prune dangling images on host
|
|
if: always()
|
|
run: docker image prune -f 2>/dev/null || true
|
|
|
|
- name: Trigger PORT redeploy
|
|
if: success()
|
|
run: |
|
|
curl -fsS -X POST https://port.alwisp.com/hooks/gitea \
|
|
-H "X-Deploy-Token: ${{ secrets.WEBHOOK_SECRET }}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"container\":\"email-sigs\"}" || echo "PORT redeploy trigger failed (non-fatal)"
|