name: Build and Push LST Docker Image

on:
  push:
    branches:
      - main

jobs:
  docker:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout (local)
        run: |
          git clone http://10.75.9.150:3100/cowch/lst_v3.git .
          git checkout ${{ gitea.sha }}

      - name: Login to registry
        run: echo "${{ secrets.PASSWORD }}" | docker login 10.75.9.150:3100 -u "cowch" --password-stdin

      - name: Build image
        run: |
          docker build \
            -t 10.75.9.150:3100/cowch/lst_v3:latest \
            -t 10.75.9.150:3100/cowch/lst_v3:${{ gitea.sha }} \
            .

      - name: Push
        run: |
          docker push 10.75.9.150:3100/cowch/lst_v3:latest
          docker push 10.75.9.150:3100/cowch/lst_v3:${{ gitea.sha }}