phpvms/.travis/deploy_script.sh

58 lines
1.6 KiB
Bash
Raw Normal View History

2017-12-14 07:03:59 +08:00
#!/usr/bin/env bash
if [ "$TRAVIS" = "true" ]; then
2017-12-14 07:03:59 +08:00
if test "$TRAVIS_TAG"; then
PKG_NAME=$TRAVIS_TAG
else
2017-12-15 22:13:42 +08:00
PKG_NAME=master
fi
2017-12-15 01:02:29 +08:00
TAR_NAME="phpvms-7.0.0-$PKG_NAME.tar.gz"
echo "Writing $TAR_NAME"
2017-12-14 07:31:58 +08:00
2017-12-31 02:01:58 +08:00
#echo "running build"
#npm run prod
2017-12-15 01:37:26 +08:00
# delete all superfluous files
echo "cleaning files"
cd $TRAVIS_BUILD_DIR
php artisan version:show --format compact --suppress-app-name > VERSION
2018-01-05 11:45:45 +08:00
VERSION=`cat VERSION`
echo "Version: $VERSION"
make clean
rm -rf env.php
2018-01-05 04:58:01 +08:00
find ./vendor -type d -name ".git" -print0 | xargs rm -rf
# clear any app specific stuff that might have been loaded in
2018-01-05 05:37:28 +08:00
find storage/app/public -mindepth 1 -not -name '.gitignore' -print0 -exec rm -rf {} +
find storage/app -mindepth 1 -not -name '.gitignore' -not -name public -print0 -exec rm -rf {} +
# Remove any development files
rm -rf .sass-cache
2017-12-15 01:37:26 +08:00
rm -rf .idea phpvms.iml .travis .dpl
rm -rf .phpstorm.meta.php _ide_helper.php phpunit.xml Procfile
# remove large sized files
rm -rf .git
2017-12-17 10:49:13 +08:00
rm -rf node_modules
2017-12-29 07:45:57 +08:00
# delete files in vendor that are rather large
rm -rf vendor/willdurand/geocoder/tests
2017-12-15 01:37:26 +08:00
echo "creating tarball"
2017-12-18 02:18:11 +08:00
cd /tmp
2018-01-05 05:22:32 +08:00
tar -czf $TAR_NAME -C $TRAVIS_BUILD_DIR/../ phpvms
2017-12-18 02:18:11 +08:00
#git archive --format=tar.gz --prefix=phpvms/ --output=test.tar.gz HEAD
2017-12-15 01:02:29 +08:00
echo "running rsync"
2017-12-15 01:09:02 +08:00
rsync -ahP --delete-after /tmp/$TAR_NAME downloads@phpvms.net:/var/www/downloads/
2018-01-05 11:45:45 +08:00
2018-01-05 11:55:56 +08:00
curl -X POST --data "{\"content\": \"A new build is available at http://phpvms.net/downloads/$TAR_NAME ($VERSION)\"}" -H "Content-Type: application/json" $DISCORD_WEBHOOK_URL
2018-01-05 11:45:45 +08:00
fi