name: Docker
on:
  push:
    branches: [ "main" ]

env:
  REGISTRY: git.lycaknight.de

jobs:
  build:
    runs-on: docker
    permissions:
      contents: read
      packages: write
      id-token: write

    steps:
      - name: Log into Container Registry
        uses: docker/login-action@v3
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ gitea.actor }}
          password: ${{ secrets.PORTFOLIO_TOKEN }}

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

      - name: Build and push Docker image
        id: build-and-push
        uses: docker/build-push-action@v6
        with:
          tags: ${{ env.REGISTRY }}/${{ gitea.repository }}:latest
          platforms: linux/amd64
          push: true