name: Mirror to GitHub

on:
  push:
    branches: [main]
    tags: ['v*']

jobs:
  mirror:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: https://github.com/actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Push to GitHub mirror
        run: |
          git remote add github "https://x-access-token:${{ secrets.GHCR_TOKEN }}@github.com/metamorphosis-dev/kafka.git"
          git push github "${{ github.ref_name }}" --force
