Compare commits

3 Commits

Author SHA1 Message Date
jason 520119f65b ci: unify to canonical docker-build workflow (drift labels baked in)
Build and Push Docker Image / build (push) Successful in 3m25s
2026-07-19 13:37:19 -05:00
Jason Stedwell d35339f75b ci: trigger PORT auto-redeploy after image push
Build and Push Docker Image / build (push) Successful in 1m3s
2026-07-18 20:25:30 -05:00
jason 0cd1d6375d Point docker-build.yml trigger at main
Build and Push Docker Image / build (push) Has been cancelled
2026-07-02 10:16:40 -05:00
+27 -6
View File
@@ -2,7 +2,7 @@ name: Build and Push Docker Image
on: on:
push: push:
branches: [master] branches: [main]
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@@ -12,6 +12,10 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
# Full history so `git rev-list --count HEAD` yields the true commit count
# driving both the app version (v1.NNN) and the org.alwisp.version label.
fetch-depth: 0
- name: Log in to Gitea Container Registry - name: Log in to Gitea Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
@@ -22,14 +26,31 @@ jobs:
- name: Build and Push - name: Build and Push
run: | run: |
# gitea.repository is already "owner/repo" (e.g. jason/breedr).
IMAGE="registry.alwisp.com/${{ gitea.repository }}" IMAGE="registry.alwisp.com/${{ gitea.repository }}"
docker build -t "${IMAGE}:latest" . GIT_SHA="$(git rev-parse --short HEAD)"
BUILD_TIME="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
COMMIT_COUNT="$(git rev-list --count HEAD)"
docker build \
--build-arg GIT_SHA="${GIT_SHA}" \
--build-arg BUILD_TIME="${BUILD_TIME}" \
--build-arg COMMIT_COUNT="${COMMIT_COUNT}" \
--label org.alwisp.git-sha="${{ gitea.sha }}" \
--label org.alwisp.version="v1.$((COMMIT_COUNT-1))" \
--label org.alwisp.repo="${{ gitea.repository }}" \
-t "${IMAGE}:latest" .
docker push "${IMAGE}:latest" docker push "${IMAGE}:latest"
# Dangling-only prune: removes untagged leftovers from previous builds. # Dangling-only prune: removes untagged leftovers from previous builds. Never
# Never removes the tagged :latest (kept for the Unraid deployment) or # removes the tagged :latest or any image referenced by a running container.
# any image referenced by a container.
- name: Prune dangling images on host - name: Prune dangling images on host
if: always() if: always()
run: docker image prune -f 2>/dev/null || true run: docker image prune -f 2>/dev/null || true
- name: Trigger PORT redeploy
if: success()
run: |
NAME="${{ gitea.repository }}"; NAME="${NAME##*/}"
curl -fsS -X POST https://port.alwisp.com/hooks/gitea \
-H "X-Deploy-Token: ${{ secrets.WEBHOOK_SECRET }}" \
-H "Content-Type: application/json" \
-d "{\"container\":\"${NAME}\"}" || echo "PORT redeploy trigger failed (non-fatal)"