Add Watchtower trigger action definition.

This commit is contained in:
Bas Weelinck 2025-10-07 22:48:05 +00:00
commit 5caa9025ce

26
action.yml Normal file
View file

@ -0,0 +1,26 @@
name: 'Trigger Watchtower'
author: 'Bas Weelinck'
description: |
Wake up Watchtower by web request, so it will deploy any new images.
inputs:
watchtower_url:
description: 'URL where Watchtower is listening'
watchtower_token:
description: 'Bearer token for authenticating to Watchtower'
runs:
using: 'composite'
steps:
- name: Signal Watchtower
shell: bash
run: |
set -e
HTTP_CODE=$(curl -H "Authorization: Bearer ${{ inputs.watchtower_token }}" ${{ inputs.watchtower_url}}/v1/update -w '%{http_code}' -o /dev/null -s)
if [[ $HTTP_CODE == "200" ]]
then
echo 'Success!'
else
echo "Unexpected HTTP response code $HTTP_CODE"
exit 1
fi