Files
transfer/scripts/create-bundle.sh
2017-05-07 22:13:24 +02:00

45 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
# Get the current tag or use commit hash if there's none
COMMIT=$(git log -n1 --pretty='%h' 2>/dev/null || echo current)
NAME=$(git describe --exact-match --tags $COMMIT 2>/dev/null || echo $COMMIT)
echo "### Building frontend apps"
echo "======================================================"
cd $DIR/../app
npm install
npm run build
echo
echo "### Bundling to _releases/psitransfer-$NAME.tar.gz"
echo "======================================================"
cd $DIR/..
mkdir -p _releases
tar -czf _releases/psitransfer-$NAME.tar.gz --transform "s~^~psitransfer-$NAME/~" \
LICENSE \
README.md \
Dockerfile \
.dockerignore \
app.js \
config.js \
package.json \
docs \
lib \
public
cd $DIR/..
if [ -d .git ]; then
LAST_TAG=$(git tag | head -n 2 | tail -n 1)
echo
echo "### Changelog $LAST_TAG..HEAD"
echo "======================================================"
[ -z "$LAST_TAG" ] && git log --oneline || git log $LAST_TAG..HEAD --oneline
fi