🚀 Docker Build and Push / build-and-push (push) Successful in 6m4s
The token is stored as an instance-level Actions Variable (Site Administration > Actions > Variables), not a Secret. secrets.WATCHTOWER_TOKEN always resolved to empty, so the watchtower trigger request carried no Authorization value and was rejected (401 Invalid token attempt).
36 lines
1.1 KiB
YAML
36 lines
1.1 KiB
YAML
name: 🚀 Docker Build and Push
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- 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
|