shlink/build.sh

50 lines
1.3 KiB
Bash
Raw Normal View History

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
if [[ "$#" -ne 1 ]]; then
echo "Usage:" >&2
echo " $0 {version}" >&2
exit 1
fi
version=$1
builtcontent="./build/shlink_${version}_dist"
2016-08-15 02:45:09 -05:00
projectdir=$(pwd)
[[ -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}"
mkdir -p "${builtcontent}"
rsync -av * "${builtcontent}" \
2019-08-16 11:38:26 -05:00
--exclude=*docker* \
--exclude=Dockerfile \
--include=.htaccess \
--exclude-from=./.dockerignore
2016-08-15 03:03:17 -05:00
cd "${builtcontent}"
2016-08-15 02:45:09 -05:00
# Install dependencies
echo "Installing dependencies with $composerBin..."
${composerBin} self-update
2020-03-21 03:37:31 -05:00
${composerBin} install --no-dev --optimize-autoloader --prefer-dist --no-progress --no-interaction
2016-08-15 02:45:09 -05:00
# Copy mezzio helper script to vendor (deprecated - Remove with Shlink 3.0.0)
cp "${projectdir}/bin/helper/mezzio-swoole" "./vendor/bin"
2016-08-15 02:45:09 -05:00
# Delete development files
echo 'Deleting dev files...'
rm composer.*
# Update shlink version in config
sed -i "s/%SHLINK_VERSION%/${version}/g" config/autoload/app_options.global.php
2016-08-15 02:45:09 -05:00
# Compressing file
echo 'Compressing files...'
cd "${projectdir}"/build
rm -f ./shlink_${version}_dist.zip
zip -ry ./shlink_${version}_dist.zip ./shlink_${version}_dist
cd "${projectdir}"
rm -rf "${builtcontent}"
echo 'Done!'