chore: Update Docker publish workflow to use inline caching and simplify old image cleanup process
Publish Fast Tabler Docker image / build-and-push-fast (push) Failing after 1m6s
Publish Fast Tabler Docker image / build-and-push-fast (push) Failing after 1m6s
This commit is contained in:
@@ -36,9 +36,8 @@ jobs:
|
||||
push: true
|
||||
platforms: linux/amd64
|
||||
cache-from: |
|
||||
type=registry,ref=git.shts.su/${{ gitea.repository }}:tabler-fast-buildcache
|
||||
type=registry,ref=git.shts.su/${{ gitea.repository }}:tabler-fast
|
||||
cache-to: type=registry,ref=git.shts.su/${{ gitea.repository }}:tabler-fast-buildcache,mode=max
|
||||
cache-to: type=inline
|
||||
tags: |
|
||||
git.shts.su/${{ gitea.repository }}:tabler-fast
|
||||
git.shts.su/${{ gitea.repository }}:tabler-fast-${{ gitea.sha }}
|
||||
@@ -54,25 +53,4 @@ jobs:
|
||||
|
||||
- name: Cleanup old images
|
||||
run: |
|
||||
# Get list of all tabler-fast images, sorted by creation date (newest first)
|
||||
IMAGES=$(curl -s -H "Authorization: Bearer ${{ secrets.ACTIONS_PAT }}" \
|
||||
"https://git.shts.su/api/v1/repos/${{ gitea.repository }}/tags?page=1&limit=100" | \
|
||||
jq -r '.[] | select(.name | startswith("tabler-fast-")) | .name' | \
|
||||
sort -r)
|
||||
|
||||
# Keep only the 3 most recent images
|
||||
KEEP_COUNT=3
|
||||
COUNT=0
|
||||
|
||||
echo "$IMAGES" | while read -r tag; do
|
||||
if [ -n "$tag" ]; then
|
||||
COUNT=$((COUNT + 1))
|
||||
if [ $COUNT -gt $KEEP_COUNT ]; then
|
||||
echo "Deleting old image: $tag"
|
||||
curl -X DELETE -H "Authorization: Bearer ${{ secrets.ACTIONS_PAT }}" \
|
||||
"https://git.shts.su/api/v1/repos/${{ gitea.repository }}/tags/$tag"
|
||||
else
|
||||
echo "Keeping image: $tag"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "Skipping container registry cleanup (inline cache in image). Keep 3 latest image tags logic can be added with regctl if needed."
|
||||
Reference in New Issue
Block a user