when:
  - event: push
    branch: main

steps:
  - name: deploy
    image: alpine
    when:
      - event: push
        path:
          - "Dockerfile"
          - "src/**"
          - "server/**"
          - "package.json"
          - "package-lock.json"
          - "vite.config.js"
          - "tailwind.config.js"
          - "postcss.config.js"
          - "index.html"
    environment:
      COOLIFY_API_TOKEN:
        from_secret: coolify_api_token
    commands:
      - apk add --no-cache curl
      - |
        COOLIFY="http://10.0.0.1:8000/api/v1"
        UUID="ng00g8sskks0ok0okk0cg8kw"
        echo "Triggering deploy in Coolify..."
        curl -sSLk -X GET "$COOLIFY/deploy?uuid=$UUID&force=false" \
          -H "Authorization: Bearer $COOLIFY_API_TOKEN"
