diff options
Diffstat (limited to 'scripts/make-archive.sh')
-rwxr-xr-x | scripts/make-archive.sh | 77 |
1 files changed, 60 insertions, 17 deletions
diff --git a/scripts/make-archive.sh b/scripts/make-archive.sh index 2518f020..b99e87ab 100755 --- a/scripts/make-archive.sh +++ b/scripts/make-archive.sh @@ -1,29 +1,72 @@ #!/bin/sh -VERSION=$1 +if [ "$#" -lt 1 ] +then + echo "Usage: $0 <version> [destination]" + exit 1 +fi + APP="kanboard" +VERSION=$1 +DESTINATION=$2 -cd /tmp +if [ -z "$2" ] +then + DESTINATION=~/Devel/websites/$APP +fi + +echo "Build package for version $VERSION => $DESTINATION" + +# Cleanup rm -rf /tmp/$APP /tmp/$APP-*.zip 2>/dev/null -git clone --depth 1 https://github.com/fguillot/$APP.git +# Download source code +cd /tmp +git clone --depth 1 -q https://github.com/fguillot/$APP.git >/dev/null + +# Install vendors +cd /tmp/$APP +composer --prefer-dist --no-dev --optimize-autoloader --quiet install + +# Remove useless files +rm -rf data/*.sqlite \ + .git \ + .gitignore \ + scripts \ + tests \ + Vagrantfile \ + .*.yml \ + README.markdown \ + docs \ + Dockerfile \ + composer.* \ + app.json -rm -rf $APP/data/*.sqlite \ - $APP/.git $APP/.gitignore \ - $APP/scripts \ - $APP/tests \ - $APP/Vagrantfile \ - $APP/.*.yml \ - $APP/README.markdown \ - $APP/docs +find ./vendor -name doc -type d -exec rm -rf {} +; +find ./vendor -name notes -type d -exec rm -rf {} +; +find ./vendor -name test -type d -exec rm -rf {} +; +find ./vendor -name tests -type d -exec rm -rf {} +; +find ./vendor -name composer.json -delete +find ./vendor -name phpunit.xml -delete +find ./vendor -name .travis.yml -delete +find ./vendor -name README.* -delete +find ./vendor -name .gitignore -delete -sed -i.bak s/master/$VERSION/g $APP/app/constants.php && rm -f $APP/app/*.bak -zip -r $APP-$VERSION.zip $APP +# Set the version number +sed -i.bak s/master/$VERSION/g app/constants.php && rm -f app/*.bak + +# Make the archive +cd /tmp +zip -r $APP-$VERSION.zip $APP > /dev/null +mv $APP-$VERSION.zip $DESTINATION -mv $APP-$VERSION.zip ~/Devel/websites/$APP +cd $DESTINATION -cd ~/Devel/websites/$APP/ -unlink $APP-latest.zip -ln -s $APP-$VERSION.zip $APP-latest.zip +# Make symlink for generic archive +if [ -L $APP-latest.zip ] +then + unlink $APP-latest.zip + ln -s $APP-$VERSION.zip $APP-latest.zip +fi rm -rf /tmp/$APP 2>/dev/null |