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
|
|
|
|
2024-02-12 13:29:40 -06:00
|
|
|
if [ "$#" -lt 1 ]; then
|
2016-08-15 03:18:13 -05:00
|
|
|
echo "Usage:" >&2
|
2024-02-12 13:29:40 -06:00
|
|
|
echo " $0 {version}" >&2
|
2016-08-15 03:18:13 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
version=$1
|
2021-02-13 05:56:41 -06:00
|
|
|
phpVersion=$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;')
|
2024-02-12 13:29:40 -06:00
|
|
|
distId="shlink${version}_php${phpVersion}_dist"
|
2021-02-13 05:56:41 -06:00
|
|
|
builtContent="./build/${distId}"
|
2016-08-15 02:45:09 -05:00
|
|
|
projectdir=$(pwd)
|
2018-12-16 02:26:08 -06: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...'
|
2021-02-13 05:56:41 -06:00
|
|
|
rm -rf "${builtContent}"
|
|
|
|
mkdir -p "${builtContent}"
|
|
|
|
rsync -av * "${builtContent}" \
|
2019-08-16 11:38:26 -05:00
|
|
|
--exclude=*docker* \
|
2019-08-16 12:30:40 -05:00
|
|
|
--exclude=Dockerfile \
|
2020-03-28 13:54:02 -05:00
|
|
|
--include=.htaccess \
|
2022-08-27 10:48:59 -05:00
|
|
|
--include=config/roadrunner/.rr.yml \
|
2019-08-16 12:30:40 -05:00
|
|
|
--exclude-from=./.dockerignore
|
2021-02-13 05:56:41 -06: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
|
2024-02-12 13:29:40 -06:00
|
|
|
${composerBin} install --no-dev --prefer-dist --optimize-autoloader --no-progress --no-interaction
|
2021-01-17 06:03:44 -06:00
|
|
|
|
2016-08-15 02:45:09 -05:00
|
|
|
# Delete development files
|
|
|
|
echo 'Deleting dev files...'
|
|
|
|
rm composer.*
|
|
|
|
|
2024-10-24 01:49:58 -05:00
|
|
|
# Update Shlink version
|
|
|
|
sed -i "s/%SHLINK_VERSION%/${version}/g" module/Core/src/Config/Options/AppOptions.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
|
2021-02-13 05:56:41 -06:00
|
|
|
rm -f ./${distId}.zip
|
|
|
|
zip -ry ./${distId}.zip ./${distId}
|
2018-09-24 12:35:45 -05:00
|
|
|
cd "${projectdir}"
|
2021-02-13 05:56:41 -06:00
|
|
|
rm -rf "${builtContent}"
|
2018-09-11 12:17:29 -05:00
|
|
|
|
|
|
|
echo 'Done!'
|