Carp/release.sh
2020-09-21 21:51:59 +02:00

55 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e;
name=$1
noprompt=$2
if [ "$name" == "" ]; then
echo "ERROR: Must pass a name of the release as the first argument to this script.";
exit 1;
fi
fullPath="$PWD/releases/$name"
echo "Creating release '$name'"
echo "Full path = '$fullPath'"
if [ "$noprompt" == "--noprompt" ]; then
echo "No prompt, will continue"
else
echo "Continue? (y/n)"
read answer
if [ "$answer" != "y" ]; then
echo "Bye!"
exit 1;
fi
fi
mkdir -p "$fullPath"
echo
echo "Building Haskell Stack project..."
stack build
mkdir "$fullPath/bin"
echo "Copying executable..."
cp "$(stack path --local-install-root)/bin/carp" $fullPath/bin/carp
echo "Copying core..."
cp -r "./core/" "$fullPath/core/"
echo "Copying docs..."
cp -r "./docs/" "$fullPath/docs/"
echo "Copying README.md..."
cp -r "./README.md" "$fullPath/README.md"
echo "Copying img..."
cp -r "./img/" "$fullPath/img/"
echo "Copying examples..."
cp -r "./examples/" "$fullPath/examples/"
echo
echo "Zipping..."
cd releases
zip -r "${name}.zip" "${name}"
echo
echo "Done. New release created successfully!"