name: build-and-push

on:
  push:
    branches:
      - main
      - high-performance

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Login to Registry
        uses: docker/login-action@v3
        with:
          registry: ${{ secrets.REGISTRY_HOSTPORT }}
          username: ${{ secrets.REGISTRY_USERNAME }}
          password: ${{ secrets.REGISTRY_PASSWORD }}

      - name: Build and push
        uses: docker/build-push-action@v5
        with:
          context: .
          push: true
          tags: |
            ${{ secrets.REGISTRY_HOSTPORT }}/nxtgauge-admin-solid:${{ gitea.sha }}
            ${{ secrets.REGISTRY_HOSTPORT }}/nxtgauge-admin-solid:${{ gitea.ref }}-latest
          dockerfile: Dockerfile
