when: branch: [main, high-performance] event: push matrix: SERVICE: - gateway - users - companies - job_seekers - customers - payments - employees - photographers - makeup_artists - tutors - developers - video_editors - graphic_designers - social_media_managers - fitness_trainers - catering_services - ugc_content_creators - cron steps: - name: detect-changes image: alpine/git commands: - apk add --no-cache bash - | #!/bin/bash set -e # Fetch previous commit for comparison git fetch --depth=2 origin +refs/heads/${CI_COMMIT_BRANCH}:refs/remotes/origin/${CI_COMMIT_BRANCH} || true # Get changed files (handle shallow clone) CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD 2>/dev/null || git diff --name-only origin/${CI_COMMIT_BRANCH}~1 origin/${CI_COMMIT_BRANCH} 2>/dev/null || echo "ALL") # If we can't detect changes, assume we should build if [ "$CHANGED_FILES" = "ALL" ] || [ -z "$CHANGED_FILES" ]; then echo "⚠️ Cannot detect changes for ${SERVICE}, assuming build needed" exit 0 fi SERVICE_PATH=$(echo "${SERVICE}" | tr '_' '-') SHARED_CHANGED=false if echo "$CHANGED_FILES" | grep -q "^crates/"; then SHARED_CHANGED=true echo "⚠️ Shared crates changed" fi SERVICE_CHANGED=false if echo "$CHANGED_FILES" | grep -q "^apps/${SERVICE_PATH}/"; then SERVICE_CHANGED=true echo "✅ Service ${SERVICE} changed" fi if [ "$SHARED_CHANGED" = "true" ] || [ "$SERVICE_CHANGED" = "true" ]; then echo "🚀 Building ${SERVICE}" exit 0 else echo "⏭️ Skipping ${SERVICE}" exit 78 fi - name: build-and-push image: woodpeckerci/plugin-docker-buildx:5.0.0 settings: registry: docker-registry.registry.svc.cluster.local:5000 repo: docker-registry.registry.svc.cluster.local:5000/nxtgauge-rust-${SERVICE} dockerfile: Dockerfile.simple build_args: - SERVICE_NAME=${SERVICE} tags: - ${CI_COMMIT_SHA} - latest - high-performance-latest logins: - registry: https://index.docker.io/v1/ username: from_secret: DOCKERHUB_USERNAME password: from_secret: DOCKERHUB_TOKEN platforms: linux/amd64 cache_from: docker-registry.registry.svc.cluster.local:5000/nxtgauge-rust-${SERVICE}:cache cache_to: docker-registry.registry.svc.cluster.local:5000/nxtgauge-rust-${SERVICE}:cache