-
Notifications
You must be signed in to change notification settings - Fork 1
30 lines (29 loc) · 1.03 KB
/
delete_image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
name: Delete Outdated Docker Image
on: delete
jobs:
delete_branch:
if: github.event.ref_type == 'branch' || github.event.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
- shell: bash
run: |
ref="${{github.ref}}"
tag=$(echo $ref | sed -e "s#refs/heads/##g" | sed -e s#/#-##g)
echo "ref=$ref" >> $GITHUB_ENV
echo "dist_tag=$tag" >> $GITHUB_ENV
echo "test_tag=test-${tag}" >> $GITHUB_ENV
- uses: ./.github/actions/delete_docker
if: github.event.ref_type == 'tag'
with:
image: ${{vars.DOCKER_IMAGE}}
tag: ${{ env.dist_tag }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: ./.github/actions/delete_docker
with:
image: ${{vars.DOCKER_IMAGE}}
tag: ${{ env.test_tag }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}