45 lines
1.5 KiB
YAML
45 lines
1.5 KiB
YAML
name: 🚀 Docker Build and Push
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: 🩺 Debug token context
|
|
env:
|
|
VARS_TOKEN: ${{ vars.WATCHTOWER_TOKEN }}
|
|
SECRETS_TOKEN: ${{ secrets.WATCHTOWER_TOKEN }}
|
|
run: |
|
|
echo "vars.WATCHTOWER_TOKEN length: ${#VARS_TOKEN}"
|
|
echo "secrets.WATCHTOWER_TOKEN length: ${#SECRETS_TOKEN}"
|
|
echo "vars first/last 2 chars: ${VARS_TOKEN:0:2}..${VARS_TOKEN: -2}"
|
|
|
|
- name: 📥 Checkout code
|
|
uses: https://github.com/actions/checkout@v4
|
|
|
|
- name: 🛠️ Set up Docker Buildx
|
|
uses: https://github.com/docker/setup-buildx-action@v3
|
|
|
|
- name: 🔐 Login to Gitea Registry
|
|
uses: https://github.com/docker/login-action@v3
|
|
with:
|
|
registry: gitea.killinger.fr
|
|
username: maxime.killinger
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
- name: 📦 Build and push Docker image
|
|
uses: https://github.com/docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
gitea.killinger.fr/maxime.killinger/crowdsec-notify:${{ github.ref_name == 'main' && 'latest' || github.ref_name }}
|
|
|
|
- name: 🔔 Trigger Watchtower
|
|
if: github.ref == 'refs/heads/main'
|
|
env:
|
|
TOKEN: ${{ vars.WATCHTOWER_TOKEN }}
|
|
run: |
|
|
curl -X POST -H "Authorization: Bearer $TOKEN" http://192.168.1.118:3026/v1/update
|