ci: add Gitea Actions CI/CD workflow
Build Docker image on push to main, push to Gitea Container Registry, and trigger Coolify redeploy. Replaces Coolify's built-in Dockerfile build with pre-built images for faster deploys and version management. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
|||||||
|
name: Build & Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
tags: ["v*"]
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: gitea.dev.marcus-law.co.il
|
||||||
|
IMAGE: espocrm-extensions/shira-hermes
|
||||||
|
COOLIFY_UUID: yfunusjvicdvncelvjszuupk
|
||||||
|
|
||||||
|
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 }}"
|
||||||
Reference in New Issue
Block a user