name: Normal upgrade
on:
  push:
    tags:
      - "v*"

jobs:
  update:
    runs-on: ubuntu-latest
    steps:
      - name: executing remote ssh commands using ssh key
        uses: appleboy/ssh-action@master
        env:
          TOKEN: ${{ secrets.BOT_TOKEN }}
        with:
          envs: TOKEN
          host: ${{ secrets.PROD_HOST }}
          username: ${{ secrets.PROD_USERNAME }}
          key: ${{ secrets.SSH_KEY }}
          script: |
            docker save bennythink/yyetsbot > /root/yyetsbot-old.tar
            docker pull bennythink/yyetsbot
            docker-compose -f /home/WebsiteRunner/docker-compose.yml up -d
            docker-compose -f /home/BotsRunner/docker-compose.yml up -d
            curl "https://api.telegram.org/bot$TOKEN/sendMessage?chat_id=260260121&text=Normal%20upgrade%20complete!"
            echo "Normal upgrade complete!"
