name: Build And Push Image

on: [push]

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      - name: Login To Registry
        uses: docker/login-action@v3
        with:
          registry: ${{ vars.REGISTRY_HOST }}
          username: ${{ vars.REGISTRY_USERNAME }}
          password: ${{ secrets.REGISTRY_TOKEN }}

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

      - name: Build And Push
        uses: docker/build-push-action@v6
        with:
          platforms: linux/amd64
          push: true
          tags: |
            ${{ vars.REGISTRY_HOST }}/${{ vars.REGISTRY_USERNAME }}/${{ vars.IMAGE_NAME }}:latest
            ${{ vars.REGISTRY_HOST }}/${{ vars.REGISTRY_USERNAME }}/${{ vars.IMAGE_NAME }}:${{ github.sha }}