-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
saxix
committed
Jun 20, 2024
1 parent
4f6ee6b
commit 257b932
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Branch Deleted | ||
on: delete | ||
jobs: | ||
delete: | ||
if: github.event.ref_type == 'branch' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
- name: Define linked test image name | ||
id: image_name | ||
run: | | ||
echo "name=${{vars.DOCKER_IMAGE}}:test-${{steps.meta.outputs.version}}" >> $GITHUB_OUTPUT | ||
- name: Clean up | ||
shell: bash | ||
run: | | ||
registry="https://registry-1.docker.io" | ||
name=${{steps.image_name.outputs.name}} | ||
curl -v -sSL -X DELETE "http://${registry}/v2/${name}/manifests/$( | ||
curl -sSL -I \ | ||
-H "Accept: application/vnd.docker.distribution.manifest.v2+json" \ | ||
"http://${registry}/v2/${name}/manifests/$( | ||
curl -sSL "http://${registry}/v2/${name}/tags/list" | jq -r '.tags[0]' | ||
)" \ | ||
| awk '$1 == "Docker-Content-Digest:" { print $2 }' \ | ||
| tr -d $'\r' \ | ||
)" | ||
- name: Define linked image name | ||
id: image_name | ||
run: | | ||
echo "name=${{vars.DOCKER_IMAGE}}:${{steps.meta.outputs.version}}" >> $GITHUB_OUTPUT | ||
- name: Clean up | ||
shell: bash | ||
run: | | ||
registry="https://registry-1.docker.io" | ||
name=${{steps.image_name.outputs.name}} | ||
curl -v -sSL -X DELETE "http://${registry}/v2/${name}/manifests/$( | ||
curl -sSL -I \ | ||
-H "Accept: application/vnd.docker.distribution.manifest.v2+json" \ | ||
"http://${registry}/v2/${name}/manifests/$( | ||
curl -sSL "http://${registry}/v2/${name}/tags/list" | jq -r '.tags[0]' | ||
)" \ | ||
| awk '$1 == "Docker-Content-Digest:" { print $2 }' \ | ||
| tr -d $'\r' \ | ||
)" |