Release - Delete Draft #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |