MadelineProto/tests/makephar.sh

57 lines
1.8 KiB
Bash
Raw Normal View History

2018-02-20 13:15:32 +01:00
#!/bin/sh -e
2018-02-21 12:55:42 +01:00
composer global require spatie/7to5
[ -f $HOME/.composer/vendor/bin/php7to5 ] && php7to5=$HOME/.composer/vendor/bin/php7to5
[ -f $HOME/.config/composer/vendor/bin/php7to5 ] && php7to5=$HOME/.config/composer/vendor/bin/php7to5
2018-02-21 12:55:42 +01:00
rm -rf phar7 phar5 MadelineProtoPhar
2018-02-21 12:55:42 +01:00
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
2018-02-21 12:55:42 +01:00
composer update
cd ..
2018-02-21 12:55:42 +01:00
$php7to5 convert --copy-all phar7 phar5
php makephar.php phar5 madeline.phar $TRAVIS_COMMIT
git clone git@github.com:danog/MadelineProtoPhar
cd MadelineProtoPhar
cp ../madeline.phar .
echo "$TRAVIS_COMMIT_MESSAGE" | grep -q release_phar && echo -n $TRAVIS_COMMIT > release
git add -A
git commit -am "Release $TRAVIS_COMMIT"
git push origin master
cd ..
2018-02-20 13:15:32 +01:00
[ -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 disable_web_page_preview=1 -F text=" <b>Recent Commits to MadelineProto:master</b>
2018-02-20 13:15:32 +01:00
<a href=\"https://github.com/danog/MadelineProto/commit/$TRAVIS_COMMIT\">$TRAVIS_COMMIT_MESSAGE</a>
$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)
2018-02-20 13:33:29 +01:00
2018-02-21 12:55:42 +01:00
echo "$TRAVIS_COMMIT_MESSAGE" | grep -q release_phar && curl -s https://api.telegram.org/bot$token/sendDocument -F caption="md5: $(md5sum madeline.phar | sed 's/\s.*//g')
2018-02-20 13:15:32 +01:00
commit: $TRAVIS_COMMIT" -F chat_id=$chat_id -F document=@madeline.phar -F reply_to_message_id=$ID
done