diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..f2f2549 --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,55 @@ +name: Build & Deploy + +on: + push: + branches: [main] + tags: ["v*"] + +env: + REGISTRY: gitea.dev.marcus-law.co.il + IMAGE: mcp-servers/nadlan-mcp + COOLIFY_UUID: b8uf2yysbgeo1un4r9fbwt35 + +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 }}"