Publish Fast Tabler Docker image / build-and-push-fast (push) Failing after 4m50s
78 lines
2.8 KiB
YAML
78 lines
2.8 KiB
YAML
name: Publish Fast Tabler Docker image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- tabler
|
|
|
|
jobs:
|
|
build-and-push-fast:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
driver-opts: |
|
|
image=moby/buildkit:v0.13.2
|
|
|
|
- name: Log in to Gitea Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.shts.su
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.ACTIONS_PAT }}
|
|
|
|
- name: Build and push Fast Tabler Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile.fast
|
|
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
|
|
tags: |
|
|
git.shts.su/${{ gitea.repository }}:tabler-fast
|
|
git.shts.su/${{ gitea.repository }}:tabler-fast-${{ gitea.sha }}
|
|
labels: |
|
|
org.opencontainers.image.title=S3 Lists Manager with Tabler UI (Fast Build)
|
|
org.opencontainers.image.description=Modern S3 Lists Manager with Tabler UI design - Fast Alpine build
|
|
org.opencontainers.image.version=tabler-fast
|
|
org.opencontainers.image.revision=${{ gitea.sha }}
|
|
org.opencontainers.image.created=${{ gitea.event.head_commit.timestamp }}
|
|
build-args: |
|
|
BUILDKIT_INLINE_CACHE=1
|
|
provenance: false
|
|
|
|
- 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 |