Files
Smartwave/.github/workflows/deploy.yaml
T
Ninluc 1a2fbf0580
Build, push image, and notify Watchtower / build-image (push) Successful in 39s
Build, push image, and notify Watchtower / notify (push) Failing after 4s
Should do the trick
2026-07-16 18:42:46 +02:00

47 lines
1.4 KiB
YAML

name: Build, push image, and notify Watchtower
on:
push:
branches:
- main # Only triggers the build on the main branch
jobs:
build-image:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Login to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: git.matthiasg.dev
username: ninluc
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: buildx-cache-${{ github.sha }}
restore-keys: |
buildx-cache-
- name: Build and push Docker image
run: |
docker build --file cloud/Dockerfile -t git.matthiasg.dev/ninluc/smartwave-api:latest .
docker push git.matthiasg.dev/ninluc/smartwave-api:latest
notify:
needs: build-image
runs-on: ubuntu-latest
steps:
- name: Notify Watchtower
run: |
# 1. Dynamically grab the Docker gateway IP of the host machine
HOST_IP=$(ip route | awk '/default/ {print $3}')
echo "Detected Docker Host Gateway IP: $HOST_IP"
# 2. Trigger Watchtower directly over local HTTP port 8080
curl -i -X POST \
-H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" \
"http://$HOST_IP:8007/v1/update"