name: Bot API Compiler

on:
  workflow_dispatch:

jobs:
  debug-builds:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Prepare for Compilation
        run: |
          git config --global user.name "alefvanoon"
          git config --global user.email "53198048+alefvanoon@users.noreply.github.com"
          git config --global credential.helper store
          echo "https://alefvanoon:${{ secrets.GH_TOKEN }}@github.com" > ~/.git-credentials

      - name: Run Script
        run: |
            chmod 755 .github/compiler.sh
            .github/compiler.sh

      - name: Upload to Archive
        run: |
          git clone https://github.com/LibreTubeAlpha/Archive bot-api
          rm -rf bot-api/exec
          mv ~/telegram-bot-api/bin/telegram-bot-api bot-api/exec
          cd bot-api
          git add -f *
          git commit -m "WORKFLOW: BUILD BINARIES"
          git push -u
