MadelineProto/tests/makephar.sh

64 lines
2.0 KiB
Bash
Raw Normal View History

2018-02-23 20:30:56 +01:00
#!/bin/bash -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-'$TRAVIS_BRANCH'#'$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 ..
$php7to5 convert --copy-all phar7 phar5 >/dev/null
2018-06-22 13:28:33 +02:00
find phar5 -type f -exec sed 's/\w* \.\.\./.../' -i {} +
2018-02-21 12:55:42 +01:00
[ "$TRAVIS_BRANCH" != "master" ] && branch="-$TRAVIS_BRANCH" || branch=""
php makephar.php phar5 "madeline$branch.phar" $TRAVIS_COMMIT
2018-02-21 12:55:42 +01:00
2018-02-21 13:05:35 +01:00
eval "$(ssh-agent -s)"
echo -e "$private_key" > madeline_rsa
chmod 600 madeline_rsa
2018-02-21 13:05:35 +01:00
ssh-add madeline_rsa
2018-02-21 12:55:42 +01:00
git clone git@github.com:danog/MadelineProtoPhar
cd MadelineProtoPhar
cp "../madeline$branch.phar" .
2018-05-10 11:38:51 +02:00
cp ../phar.php ../mtproxyd .
[ "$TRAVIS_BRANCH" == "master" ] && echo -n $TRAVIS_COMMIT > release
2018-02-21 12:55:42 +01:00
git add -A
git commit -am "Release $TRAVIS_BRANCH $TRAVIS_COMMIT"
2018-02-21 12:55:42 +01:00
git push origin master
cd ..
echo "$TRAVIS_COMMIT_MESSAGE" | grep "Apply fixes from StyleCI" && exit
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
2018-03-02 01:45:07 +01:00
ID=$(curl -s https://api.telegram.org/bot$token/sendMessage -F disable_web_page_preview=1 -F text=" <b>Recent Commits to MadelineProto:$TRAVIS_BRANCH</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-20 13:15:32 +01:00
done