#!/bin/sh -e composer global require spatie/7to5 rm -rf phar7 phar5 mkdir phar7 cd phar7 echo '{ "name": "danog/madelineprototests", "minimum-stability":"dev", "require": { "danog/madelineproto": "dev-master#'$TRAVIS_COMMIT'" }, "repositories": [ { "type": "git", "url": "https://github.com/danog/phpseclib" } ], "authors": [ { "name": "Daniil Gentili", "email": "daniil@daniil.it" } ] }' > composer.json composer update cd .. $HOME/.composer/vendor/bin/php7to5 convert --copy-all phar7 phar5 php makephar.php phar5 madeline.phar $TRAVIS_COMMIT [ -d JSON.sh ] || git clone https://github.com/dominictarr/JSON.sh for chat_id in $destinations;do ID=$(curl -s https://api.telegram.org/bot$token/sendMessage -F text=" Recent Commits to MadelineProto:master $TRAVIS_COMMIT_MESSAGE $TRAVIS_COMMIT_MESSAGE" -F parse_mode="HTML" -F chat_id=$chat_id | JSON.sh/JSON.sh -s | egrep '\["result","message_id"\]' | cut -f 2 | cut -d '"' -f 2) curl -s https://api.telegram.org/bot$token/sendDocument -F caption="md5: $(md5sum madeline.phar | sed 's/\s.*//g') commit: $TRAVIS_COMMIT" -F chat_id=$chat_id -F document=@madeline.phar -F reply_to_message_id=$ID done