name: Automated Container Build

on:
  push:
    branches:
      - main

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

      - name: Log into Local Registry
        run: |
          echo "${{ secrets.GITHUB_TOKEN }}" | docker login 172.17.0.1:3030 -u "${{ gitea.actor }}" --password-stdin

      - name: Build and Push Image
        run: |
          docker build -t 172.17.0.1:3030/${{ gitea.actor }}/${{ github.event.repository.name }}:latest .
          docker push 172.17.0.1:3030/${{ gitea.actor }}/${{ github.event.repository.name }}:latest