Delete Docker Tags with Wildcard #10
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: Delete Docker Tags with Wildcard | |
on: | |
delete: | |
branches: | |
- "**" | |
workflow_dispatch: | |
inputs: | |
tag_pattern: | |
description: 'Wildcard pattern for Docker tags to delete' | |
required: true | |
default: "branch-name" | |
jobs: | |
find-images: | |
name: Find docker images needing deleted | |
runs-on: ubuntu-latest | |
outputs: | |
images: ${{ steps.images.outputs.images }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Find docker files | |
id: images | |
run: | | |
images=$(find examples -name Dockerfile | jq -c --raw-input --slurp 'split("\n")| .[0:-1]' | jq -r '.[]' | \ | |
awk -F'/' '{print "scyllaridae-" $2}' | \ | |
jq -c -R -s '. | split("\n") | .[0:-1] | . + ["scyllaridae"]') | |
echo "images=$images" >> $GITHUB_OUTPUT | |
delete-docker-tags: | |
needs: [find-images] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
image: ${{ fromJson(needs.find-images.outputs.images )}} | |
max-parallel: 1 # go easy on the dockerhub API | |
fail-fast: false | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Delete Docker Tags | |
run: ./ci/delete-tags.sh | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKER_REPOSITORY: "lehighlts" | |
DOCKER_IMAGE: ${{ matrix.image }} | |
TAG_PATTERN: "^${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag_pattern || github.ref_name }}.*" |