name: Build and Push Docker Images on: push: branches: - main paths: - 'apps/worker/**' - 'apps/api/**' - 'apps/web/**' jobs: build: runs-on: ubuntu-latest strategy: matrix: component: [worker, api, web] steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Docker config run: | mkdir -p .docker echo "{\"auths\":{\"https://index.docker.io/v1/\":{\"auth\":\"$(echo -n "${{ secrets.REGISTRY_USERNAME }}:${{ secrets.REGISTRY_PASSWORD }}" | base64 | tr -d '\n')\"}}}" > .docker/config.json - name: Build and Push with Kaniko uses: docker://gcr.io/kaniko-project/executor:debug with: args: >- --dockerfile=apps/${{ matrix.component }}/Dockerfile --context=dir://${{ github.workspace }} --destination=frankchine/geocrop-${{ matrix.component }}:${{ github.sha }} --destination=frankchine/geocrop-${{ matrix.component }}:latest --cache=true env: DOCKER_CONFIG: ${{ github.workspace }}/.docker deploy: runs-on: ubuntu-latest needs: build steps: - name: Checkout repository uses: actions/checkout@v4 with: token: ${{ secrets.GITEA_TOKEN }} - name: Update Manifests run: | cd k8s/base # Install kustomize if not present if ! command -v kustomize &> /dev/null; then curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash chmod +x kustomize mv kustomize /usr/local/bin/ fi kustomize edit set image frankchine/geocrop-api=frankchine/geocrop-api:${{ github.sha }} kustomize edit set image frankchine/geocrop-worker=frankchine/geocrop-worker:${{ github.sha }} kustomize edit set image frankchine/geocrop-web=frankchine/geocrop-web:${{ github.sha }} - name: Commit and Push run: | git config --global user.name "Gitea Action" git config --global user.email "action@gitea.com" # Use external URL for reliability git remote set-url origin https://x-access-token:${{ secrets.GITEA_TOKEN }}@git.techarvest.co.zw/fchinembiri/geocrop-platform..git git add k8s/base/kustomization.yaml git commit -m "ci: update image tags to ${{ github.sha }} [skip ci]" || echo "No changes to commit" git push origin main