ffffng/publish.sh

49 lines
709 B
Bash
Raw Normal View History

2016-06-11 19:08:46 +02:00
#!/usr/bin/env bash
set -e
2016-06-11 20:13:38 +02:00
function confirm() {
msg="$1 [y/n] "
echo -n $msg
while read -n1 c; do
echo
if [ "$c" == "y" ]; then
return 0
fi
if [ "$c" == "n" ]; then
return 1
fi
echo -n $msg
done
}
2016-06-11 19:08:46 +02:00
cd $(dirname $0)
version=$(grep '^ *"version": *"[^"]*" *, *$' package.json | cut -d '"' -f4)
if [ -z "$version" ]; then
echo "Could not determine current version."
exit 1
fi
2016-06-20 22:49:03 +02:00
echo "Current version: $version"
2016-06-11 19:08:46 +02:00
if [[ $version =~ 'SNAPSHOT' ]]; then
echo "Will not publish SNAPSHOT version."
exit 1
fi
2016-06-11 20:13:38 +02:00
echo
2016-06-11 19:08:46 +02:00
2016-06-11 20:13:38 +02:00
if confirm "Continue publishing?"; then
2022-05-19 11:12:07 +02:00
yarn run dist
2016-06-11 20:13:38 +02:00
cd dist
2022-05-19 11:12:07 +02:00
yarn publish
2016-06-11 20:13:38 +02:00
fi