37 lines
1.1 KiB
YAML
37 lines
1.1 KiB
YAML
name: "Deploy via package-updater"
|
|
description: "Notifies package-updater to pull & restart a Docker Compose service"
|
|
inputs:
|
|
endpoint:
|
|
description: "Full URL to /update (e.g. https://updater.example.com/update)"
|
|
required: true
|
|
image:
|
|
description: "Image reference without tag (e.g. registry.example.com/myapp)"
|
|
required: true
|
|
tag:
|
|
description: "Tag that was just pushed (for logging)"
|
|
required: false
|
|
default: ""
|
|
token:
|
|
description: "Bearer token for package-updater"
|
|
required: true
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Trigger update
|
|
shell: bash
|
|
env:
|
|
TOKEN: ${{ inputs.token }}
|
|
run: |
|
|
response=$(curl -sS -w "\n%{http_code}" \
|
|
-X POST "${{ inputs.endpoint }}" \
|
|
-H "Authorization: Bearer $TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"image\":\"${{ inputs.image }}\",\"tag\":\"${{ inputs.tag }}\"}")
|
|
body=$(echo "$response" | head -n -1)
|
|
code=$(echo "$response" | tail -n 1)
|
|
echo "HTTP $code"
|
|
echo "$body" | jq .
|
|
if [ "$code" -ge 400 ]; then
|
|
exit 1
|
|
fi
|