rsnext/publish-release.sh

41 lines
849 B
Bash
Raw Normal View History

#!/bin/bash
git describe --exact-match
if [[ ! $? -eq 0 ]];then
echo "Nothing to publish, exiting.."
exit 0;
fi
if [[ -z "$NPM_TOKEN" ]];then
echo "No NPM_TOKEN, exiting.."
exit 0;
fi
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
if [[ $(git describe --exact-match 2> /dev/null || :) =~ -canary ]];
then
echo "Publishing canary"
yarn run lerna publish from-git --npm-tag canary --yes
# Make sure to exit script with code 1 if publish failed
if [[ ! $? -eq 0 ]];then
exit 1;
fi
else
echo "Did not publish canary"
fi
if [[ ! $(git describe --exact-match 2> /dev/null || :) =~ -canary ]];then
echo "Publishing stable"
yarn run lerna publish from-git --yes
# Make sure to exit script with code 1 if publish failed
if [[ ! $? -eq 0 ]];then
exit 1;
fi
else
echo "Did not publish stable"
fi