Skip to content

Commit 9ad4be6

Browse files
committed
Delete all other images in ecr
1 parent be76d0a commit 9ad4be6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

.github/workflows/main.yml

+9
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ jobs:
4242
build-args: |
4343
DATABASE_URL=your_database_url
4444
45+
- name: Delete Old Images in ACR
46+
run: |
47+
# Get the list of images and filter to keep the latest one
48+
latest_image="${{ secrets.AZURE_URL }}/incstats:${{ github.sha }}"
49+
az acr repository show-tags --name sbuincstatsnorwayeastecr --repository incstats --query "[?starts_with(@, 'incstats:')]." -o tsv | \
50+
grep -v "$latest_image" | while read -r image; do
51+
az acr repository delete --name <your_acr_name> --image incstats:$image --yes
52+
done
53+
4554
- name: Redeploy Azure Container App
4655
run: |
4756
az containerapp revision copy \

0 commit comments

Comments
 (0)