diff --git a/.github/workflows/dockerhub-backend.yml b/.github/workflows/dockerhub-backend.yml index 6634caba..7a6c418b 100644 --- a/.github/workflows/dockerhub-backend.yml +++ b/.github/workflows/dockerhub-backend.yml @@ -42,7 +42,7 @@ jobs: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=ref,event=branch - type=sha,prefix={{branch}}- + type=ref,event=tag type=raw,value=latest,enable={{is_default_branch}} - name: Set up Docker Buildx diff --git a/.github/workflows/dockerhub-frontend.yml b/.github/workflows/dockerhub-frontend.yml index a55fe656..8eba8c17 100644 --- a/.github/workflows/dockerhub-frontend.yml +++ b/.github/workflows/dockerhub-frontend.yml @@ -42,7 +42,7 @@ jobs: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=ref,event=branch - type=sha,prefix={{branch}}- + type=ref,event=tag type=raw,value=latest,enable={{is_default_branch}} github-token: ${{ secrets.GITHUB_TOKEN }} @@ -61,10 +61,18 @@ jobs: cache-to: type=gha,mode=max platforms: linux/amd64,linux/arm64 + deploy: + needs: build-and-push + runs-on: ubuntu-latest + if: success() + strategy: + matrix: + environment: [reflector-monadical, reflector-media] + environment: ${{ matrix.environment }} + steps: - name: Trigger Coolify deployment - if: success() run: | curl -X POST "${{ secrets.COOLIFY_WEBHOOK_URL }}" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${{ secrets.COOLIFY_WEBHOOK_TOKEN }}" \ - -f || (echo "Failed to trigger Coolify deployment" && exit 1) + -f || (echo "Failed to trigger Coolify deployment for ${{ matrix.environment }}" && exit 1) diff --git a/.secrets.example b/.secrets.example index 22e94406..5476473b 100644 --- a/.secrets.example +++ b/.secrets.example @@ -15,8 +15,10 @@ GITHUB_TOKEN=your-github-token-or-use-default-GITHUB_TOKEN # Coolify Deployment Webhook (required for frontend deployment) # Used to trigger automatic deployment after image push -COOLIFY_WEBHOOK_URL=https://app.monadical.io/api/v1/deploy?uuid=your-uuid&force=false -COOLIFY_WEBHOOK_TOKEN=your-coolify-webhook-token +# Configure these secrets in GitHub Environments: +# Each environment should have: +# - COOLIFY_WEBHOOK_URL: The webhook URL for that specific deployment +# - COOLIFY_WEBHOOK_TOKEN: The webhook token (can be the same for both if using same token) # Optional: GitHub Actions Cache Token (for local testing with act) GHA_CACHE_TOKEN=your-github-token-or-empty