name: build-and-push
on:
  push:
    branches: [main, master]
    tags: ['v*']
  workflow_dispatch: {}

jobs:
  image:
    runs-on: cxai-hostinger
    steps:
      - uses: actions/checkout@v4
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
      - name: Login to cxai registry
        uses: docker/login-action@v3
        with:
          registry: registry.76-13-126-127.nip.io
          username: ${{ secrets.REGISTRY_USER }}
          password: ${{ secrets.REGISTRY_PASS }}
      - name: Build & push
        uses: docker/build-push-action@v6
        with:
          context: .
          push: true
          tags: |
            registry.76-13-126-127.nip.io/cxai/cxwebapp:latest
            registry.76-13-126-127.nip.io/cxai/cxwebapp:${{ github.sha }}
