name: Build and push Docker image (Gitea)

on:
  push:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: docker/setup-buildx-action@v3
      - uses: docker/login-action@v3
        with:
          registry: git.byte-mate.ru
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GIT_PASSWORD }}
      - uses: docker/build-push-action@v6
        with:
          context: .
          push: true
          tags: |
            git.byte-mate.ru/coder/ufahack2024:latest
            git.byte-mate.ru/coder/ufahack2024:${{ gitea.sha }}

# Notes:
#   - Create the GIT_PASSWORD secret in the Gitea repository settings.
#   - A Gitea Actions runner must be registered on the server for this
#     workflow to run.