Add CI/CD workflow for pre-built Docker image deployment

This commit is contained in:
2026-04-13 20:41:59 +00:00
parent d0b87b16dc
commit c2269f8d58
+55
View File
@@ -0,0 +1,55 @@
name: Build & Deploy
on:
push:
branches: [main]
tags: ["v*"]
env:
REGISTRY: gitea.dev.marcus-law.co.il
IMAGE: espocrm-extensions/extension-platform
COOLIFY_UUID: eu7qjwzfct9xvb2duqpxl35s
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Gitea Registry
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | \
docker login ${{ env.REGISTRY }} \
-u "${{ secrets.REGISTRY_USER }}" --password-stdin
- name: Build and tag image
run: |
BASE="${{ env.REGISTRY }}/${{ env.IMAGE }}"
TAGS="-t ${BASE}:latest -t ${BASE}:build-${{ github.run_number }}"
REF="${{ github.ref }}"
if [[ "$REF" == refs/tags/v* ]]; then
VERSION="${REF#refs/tags/}"
TAGS="$TAGS -t ${BASE}:${VERSION}"
fi
docker build $TAGS .
- name: Push image
run: |
BASE="${{ env.REGISTRY }}/${{ env.IMAGE }}"
docker push "${BASE}:latest"
docker push "${BASE}:build-${{ github.run_number }}"
REF="${{ github.ref }}"
if [[ "$REF" == refs/tags/v* ]]; then
VERSION="${REF#refs/tags/}"
docker push "${BASE}:${VERSION}"
fi
- name: Trigger Coolify redeploy
run: |
curl -sf \
"http://coolify:8080/api/v1/deploy?uuid=${{ env.COOLIFY_UUID }}&force=true" \
-H "Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}"