--- kind: pipeline type: docker name: Deploy Tox Bot clone: disable: true steps: - name: Clone repo image: alpine/git extra_hosts: - "git.santic-zombie.ru:11.1.1.20" commands: - ping -c 1 git.santic-zombie.ru - git clone https://git.santic-zombie.ru/santic/tox-bot.git . - git checkout $DRONE_COMMIT - tar -czpf tox.tar.gz * - name: Prepare to deploy image: appleboy/drone-ssh settings: host: - 11.1.1.21 username: tox key: from_secret: rsa_key port: 22 command_timeout: 2m script: - if [ ! -d ~/tox_source ]; then mkdir ~/tox_source; fi - if [ ! -d ~/tox_bot ]; then mkdir ~/tox_bot; fi - if [ ! -d ~/.config/systemd/user/ ]; then mkdir ~/.config/systemd/user/; fi - if [ -f ~/tox_bot/echo_bot ]; then rm ~/tox_bot/echo_bot; fi - name: Copy source bot files image: appleboy/drone-scp settings: host: - 11.1.1.21 username: tox key: from_secret: rsa_key port: 22 target: ~/ source: tox.tar.gz - name: Build, deploy, clean image: appleboy/drone-ssh settings: host: - 11.1.1.21 username: tox key: from_secret: rsa_key port: 22 command_timeout: 2m script: - tar -xvzf tox.tar.gz -C ~/tox_source - ls -la ~/tox_source - cd ~/tox_source/src - gcc -o echo_bot tox_bot.c commands.c misc.c -std=gnu99 -lsodium -I /usr/local/include/ -ltoxcore -lconfig - cp echo_bot ~/tox_bot - cp -f ../bot.cfg ../masterkeys.txt ~/tox_bot/ - cp -f ../tox_bot.service ~/.config/systemd/user/ #- sudo systemctl restart tox_bot.service - ls -lta ~/tox_bot - rm -rfd ~/tox_source - rm ~/tox.tar.gz