2016-08-15 02:45:09 -05:00
|
|
|
#!/usr/bin/env bash
|
2016-08-15 02:52:44 -05:00
|
|
|
set -e
|
2016-08-15 02:45:09 -05:00
|
|
|
|
2016-08-15 03:18:13 -05:00
|
|
|
if [ "$#" -ne 1 ]; then
|
|
|
|
echo "Usage:" >&2
|
|
|
|
echo " $0 {version}" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
version=$1
|
2018-09-24 12:35:45 -05:00
|
|
|
builtcontent="./build/shlink_${version}_dist"
|
2016-08-15 02:45:09 -05:00
|
|
|
projectdir=$(pwd)
|
2018-09-11 12:17:29 -05:00
|
|
|
[ -f ./composer.phar ] && composerBin='./composer.phar' || composerBin='composer'
|
2016-08-15 02:45:09 -05:00
|
|
|
|
|
|
|
# Copy project content to temp dir
|
|
|
|
echo 'Copying project files...'
|
|
|
|
rm -rf "${builtcontent}"
|
2018-09-24 12:35:45 -05:00
|
|
|
mkdir -p "${builtcontent}"
|
|
|
|
rsync -av * "${builtcontent}" \
|
|
|
|
--exclude=data/infra \
|
2018-10-20 02:00:29 -05:00
|
|
|
--exclude=data/migrations_template.txt \
|
2018-11-12 14:51:14 -06:00
|
|
|
--exclude=data/GeoLite2-City.mmdb \
|
2018-09-24 12:35:45 -05:00
|
|
|
--exclude=**/.gitignore \
|
|
|
|
--exclude=CHANGELOG.md \
|
|
|
|
--exclude=composer.lock \
|
|
|
|
--exclude=vendor \
|
|
|
|
--exclude=docs \
|
|
|
|
--exclude=indocker \
|
|
|
|
--exclude=docker* \
|
|
|
|
--exclude=func_tests_bootstrap.php \
|
|
|
|
--exclude=php* \
|
|
|
|
--exclude=infection.json \
|
|
|
|
--exclude=phpstan.neon \
|
|
|
|
--exclude=config/autoload/*local* \
|
|
|
|
--exclude=**/test* \
|
|
|
|
--exclude=build*
|
2016-08-15 03:03:17 -05:00
|
|
|
cd "${builtcontent}"
|
2016-08-15 02:45:09 -05:00
|
|
|
|
|
|
|
# Install dependencies
|
2018-09-11 12:17:29 -05:00
|
|
|
echo "Installing dependencies with $composerBin..."
|
2018-09-24 12:35:45 -05:00
|
|
|
${composerBin} self-update
|
|
|
|
${composerBin} install --no-dev --optimize-autoloader --no-progress --no-interaction
|
2016-08-15 02:45:09 -05:00
|
|
|
|
|
|
|
# Delete development files
|
|
|
|
echo 'Deleting dev files...'
|
|
|
|
rm composer.*
|
2018-09-24 12:35:45 -05:00
|
|
|
rm -f data/database.sqlite
|
2016-08-15 02:45:09 -05:00
|
|
|
|
2018-07-26 11:44:04 -05:00
|
|
|
# Update shlink version in config
|
2018-07-26 13:35:02 -05:00
|
|
|
sed -i "s/%SHLINK_VERSION%/${version}/g" config/autoload/app_options.global.php
|
2018-07-26 11:44:04 -05:00
|
|
|
|
2016-08-15 02:45:09 -05:00
|
|
|
# Compressing file
|
2018-09-11 12:17:29 -05:00
|
|
|
echo 'Compressing files...'
|
2018-09-24 12:35:45 -05:00
|
|
|
cd "${projectdir}"/build
|
|
|
|
rm -f ./shlink_${version}_dist.zip
|
|
|
|
zip -ry ./shlink_${version}_dist.zip ./shlink_${version}_dist
|
|
|
|
cd "${projectdir}"
|
2016-08-15 03:18:13 -05:00
|
|
|
rm -rf "${builtcontent}"
|
2018-09-11 12:17:29 -05:00
|
|
|
|
|
|
|
echo 'Done!'
|