Skip to content

Commit c057aea

Browse files
committed
chore: added reusable workflow clean registry
1 parent 2489226 commit c057aea

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

.github/workflows/docker-builds.yml

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,20 @@ name: Build Docker Images
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches:
6+
- main
77

88
jobs:
9-
109
ghcr-build-redis:
1110
runs-on: ubuntu-latest
1211
container:
13-
image: gcr.io/kaniko-project/executor:v1.23.0-debug
12+
image: gcr.io/kaniko-project/executor:v1.23.0-debug
1413
options: --entrypoint /bin/sh
1514
permissions:
16-
packages: write
15+
packages: write
1716

18-
1917
steps:
2018

21-
2219
- name: Set branch name as environment variable
2320
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
2421

@@ -48,24 +45,20 @@ jobs:
4845
GH_REGISTRY: "ghcr.io"
4946
IMAGE_NAME: "${{ github.repository }}/redis"
5047

51-
52-
delete-old-images:
53-
runs-on: ubuntu-latest
5448

55-
steps:
56-
- name: Trigger Delete Old Image Workflow
57-
run: |
58-
curl -X POST \
59-
-H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
60-
-H "Accept: application/vnd.github.v3+json" \
61-
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/${{ env.ACTION_NAME }}/dispatches" \
62-
-d '{"ref": "main"}'
63-
env:
64-
ACTION_NAME: delete-old-image.yml
49+
50+
call-delete-old-images:
51+
uses: multi-repo/workflows/.github/workflows/clean-registry.yml@main
52+
with:
53+
owner: vwency
54+
repository: nestjs-api
55+
package: nestjs-api/nest-api
56+
keep_n_tagged: 1
57+
dry_run: false
6558

6659

6760
deploy:
68-
needs: [delete-old-images, ghcr-build-redis]
61+
needs: [call-delete-old-images, ghcr-build-redis]
6962
runs-on: ubuntu-latest
7063
steps:
7164
- name: Deploy to environment

0 commit comments

Comments
 (0)