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
|
2017-07-03 05:54:50 -05:00
|
|
|
builtcontent=$(readlink -f "../shlink_${version}_dist")
|
2016-08-15 02:45:09 -05:00
|
|
|
projectdir=$(pwd)
|
|
|
|
|
|
|
|
# Copy project content to temp dir
|
|
|
|
echo 'Copying project files...'
|
|
|
|
rm -rf "${builtcontent}"
|
|
|
|
mkdir "${builtcontent}"
|
2017-01-22 04:27:56 -06:00
|
|
|
sudo chmod -R 777 "${projectdir}"/data/infra/{database,nginx}
|
2016-08-15 02:45:09 -05:00
|
|
|
cp -R "${projectdir}"/* "${builtcontent}"
|
2016-08-15 03:03:17 -05:00
|
|
|
cd "${builtcontent}"
|
2016-08-15 02:45:09 -05:00
|
|
|
|
|
|
|
# Install dependencies
|
2017-10-23 06:44:50 -05:00
|
|
|
rm -rf vendor
|
|
|
|
rm -f composer.lock
|
2016-08-15 02:45:09 -05:00
|
|
|
composer self-update
|
2017-01-22 04:27:56 -06:00
|
|
|
composer 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 build.sh
|
|
|
|
rm CHANGELOG.md
|
|
|
|
rm composer.*
|
|
|
|
rm LICENSE
|
2017-07-03 05:49:32 -05:00
|
|
|
rm indocker
|
|
|
|
rm docker-compose.yml
|
2018-05-07 04:09:32 -05:00
|
|
|
rm docker-compose.override.yml
|
|
|
|
rm docker-compose.override.yml.dist
|
|
|
|
rm func_tests_bootstrap.php
|
2016-08-15 02:45:09 -05:00
|
|
|
rm php*
|
|
|
|
rm README.md
|
2018-05-07 04:09:32 -05:00
|
|
|
rm infection.json
|
2017-10-23 06:44:50 -05:00
|
|
|
rm -rf build
|
|
|
|
rm -ff data/database.sqlite
|
2017-01-22 04:27:56 -06:00
|
|
|
rm -rf data/infra
|
2016-08-16 04:51:05 -05:00
|
|
|
rm -rf data/{cache,log,proxies}/{*,.gitignore}
|
|
|
|
rm -rf config/params/{*,.gitignore}
|
|
|
|
rm -rf config/autoload/{{,*.}local.php{,.dist},.gitignore}
|
2016-08-15 02:45:09 -05:00
|
|
|
|
2018-07-26 11:44:04 -05:00
|
|
|
# Update shlink version in config
|
|
|
|
latestShlinkVersion=$(git tag -l --sort=-v:refname | head -n 1)
|
|
|
|
computedVersion=${latestShlinkVersion:1:${#latestShlinkVersion}}
|
|
|
|
sed -i "s/%SHLINK_VERSION%/${computedVersion}/g" config/autoload/app_options.global.php
|
|
|
|
|
2016-08-15 02:45:09 -05:00
|
|
|
# Compressing file
|
2016-08-16 04:51:05 -05:00
|
|
|
rm -f "${projectdir}"/build/shlink_${version}_dist.zip
|
2017-07-03 05:54:50 -05:00
|
|
|
zip -ry "${projectdir}"/build/shlink_${version}_dist.zip "../shlink_${version}_dist"
|
2016-08-15 03:18:13 -05:00
|
|
|
rm -rf "${builtcontent}"
|