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