name: Testing Torrents Container

on:
  workflow_dispatch:

env:
    REGISTRY: ghcr.io
    ORG: dumtruck
    PROJECT: konobangu

jobs:
  build-container:
    runs-on: ubuntu-latest
    permissions:
        contents: read
        packages: write
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
      - name: Log in to GHCR
        uses: docker/login-action@v3
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - name: Build and push Docker image
        uses: docker/build-push-action@v5
        with:
          context: 'packages/testing-torrents'
          file: 'packages/testing-torrents/Dockerfile'
          push: true
          tags: '${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.PROJECT }}-testing-torrents:latest'
          cache-from: type=gha
          cache-to: type=gha,mode=max
