Skip to content

chore: add renovate #15

chore: add renovate

chore: add renovate #15

name: Build and Push Meridian Docker Image
on:
push:
branches:
- master
paths:
- "apps/meridian/**"
- "packages/**"
- ".github/workflows/meridian-docker.yml"
workflow_dispatch:
env:
IMAGE_NAME: nonplay/meridian
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: .
file: ./apps/meridian/Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Clean up old Docker Hub tags
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
TOKEN=$(curl -s -X POST \
'https://hub.docker.com/v2/users/login' \
-H 'Content-Type: application/json' \
-d "{\"username\": \"${DOCKERHUB_USERNAME}\", \"password\": \"${DOCKERHUB_TOKEN}\"}" \
| jq -r '.token')
TAGS_TO_DELETE=$(curl -s \
-H "Authorization: JWT ${TOKEN}" \
"https://hub.docker.com/v2/repositories/${{ env.IMAGE_NAME }}/tags?page_size=100&ordering=-last_updated" \
| jq -r '[.results[] | select(.name | test("^master-[a-f0-9]+$"))] | sort_by(.last_updated) | reverse | .[2:] | .[].name')
for tag in $TAGS_TO_DELETE; do
echo "Deleting tag: $tag"
curl -s -X DELETE \
-H "Authorization: JWT ${TOKEN}" \
"https://hub.docker.com/v2/repositories/${{ env.IMAGE_NAME }}/tags/${tag}/"
done
- name: Trigger Dokploy Deployment
run: |
curl -X POST \
'${{ secrets.DOKPLOY_DOMAIN }}/api/application.deploy' \
-H 'accept: application/json' \
-H 'x-api-key: ${{ secrets.DOKPLOY_API_KEY }}' \
-H 'Content-Type: application/json' \
-H 'X-Internal-Token: ${{ secrets.CF_BYPASS_TOKEN }}' \
-d '{"applicationId": "${{ secrets.MERIDIAN_APPLICATION_ID }}"}'