chore: add workflow to delete Docker tags

This commit is contained in:
jubnl
2026-04-10 07:44:10 +02:00
parent 6caa966a52
commit 8402f3bcfd
5 changed files with 32 additions and 6 deletions
+26
View File
@@ -0,0 +1,26 @@
name: Delete Docker tag
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to delete (e.g. 2.10.0)'
required: true
jobs:
delete-tag:
runs-on: ubuntu-latest
steps:
- name: Delete tag from Docker Hub
run: |
TOKEN=$(curl -s -X POST \
-H "Content-Type: application/json" \
-d '{"username":"${{ secrets.DOCKERHUB_USERNAME }}","password":"${{ secrets.DOCKERHUB_TOKEN }}"}' \
https://hub.docker.com/v2/users/login | jq -r .token)
STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X DELETE \
-H "Authorization: JWT ${TOKEN}" \
"https://hub.docker.com/v2/repositories/mauriceboe/trek/tags/${{ inputs.tag }}/")
echo "Response: $STATUS"
[ "$STATUS" = "204" ] && echo "Tag deleted." || echo "Failed (HTTP $STATUS)."