Skip to content

Release - Delete Draft #2

Release - Delete Draft

Release - Delete Draft #2

Workflow file for this run

name: Release - Delete
on:
workflow_dispatch:
inputs:
tag:
type: string
description: Delete the specified tag
permissions:
contents: write
packages: write
env:
GH_TOKEN: ${{ github.token }}
jobs:
release-delete:
runs-on: ubuntu-latest
steps:
- name: Check tag
if: "${{ github.event.inputs.tag == '' }}"
run: echo "::error::Missing tag from input" && exit 1
- name: Delete packages from Github Container Registry
run: |
CURRENT_TAG=${{ github.event.inputs.tag }}
echo "Deleting packages with tag ${CURRENT_TAG}"
JQ_QUERY=".[] | select(.metadata.container.tags[] == \"${CURRENT_TAG}\" or .metadata.container.tags[] == \"${CURRENT_TAG}-kubelet\")"
PACKAGES_TO_DELETE=$(gh api /user/packages/container/k3k/versions --jq "${JQ_QUERY}")
echo $PACKAGES_TO_DELETE | jq
for id in $(echo $PACKAGES_TO_DELETE | jq .id); do
echo "Deleting ${id}"
done
- name: Delete Github release
run: |
CURRENT_TAG=${{ github.event.inputs.tag }}
echo "Deleting releare ${CURRENT_TAG}"
# gh release delete ${CURRENT_TAG}