name: Build and Push Docker Image

on:
  workflow_dispatch:

env:
  IMAGE_NAME: osc/skins-image

jobs:
  build_and_push:
    name: Build and Push Docker Image
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

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

      - name: Log in to Gitea Container Registry
        uses: docker/login-action@v3
        with:
          registry: ${{ secrets.CONTAINER_REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.TOKEN }}

      - name: Build and Push Docker image
        run: |
          docker build -t ${{ secrets.CONTAINER_REGISTRY }}/$IMAGE_NAME:latest .
          docker push ${{ secrets.CONTAINER_REGISTRY }}/$IMAGE_NAME:latest
