# This workflow restarts your bot whenever you merge into the branch called 'main' name: Update Bot on: push: branches: [ main ] workflow_dispatch: env: REPO_NAME: ${{ github.event.repository.name }} jobs: deploy-via-sftp: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: SFTP Deploy uses: wlixcc/SFTP-Deploy-Action@v1.2.1 with: username: root server: # 123.45.678.890 port: 22 ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} local_path: ./* remote_path: /root/${{ env.REPO_NAME }}/ args: '-o ConnectTimeout=5' restart-bot: needs: [deploy-via-sftp] runs-on: ubuntu-latest steps: - id: creating-systemctl-service uses: fifsky/ssh-action@master with: command: sudo systemctl start ${{ env.REPO_NAME }}-watcher.service host: # 123.45.678.890 user: root key: ${{ secrets.SSH_PRIVATE_KEY }}