From a1d445c525d1f4b462e3a876684a7d2c949460ef Mon Sep 17 00:00:00 2001 From: Nemi Shah Date: Fri, 3 Jun 2022 11:07:35 +0530 Subject: [PATCH] Add publish script --- .circleci/publish.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 .circleci/publish.sh diff --git a/.circleci/publish.sh b/.circleci/publish.sh new file mode 100755 index 00000000..8ea740f1 --- /dev/null +++ b/.circleci/publish.sh @@ -0,0 +1,17 @@ +version=$(cat ../package.json | jq .version | tr -d '"') +isLatest=`curl -s -X GET \ +"https://api.supertokens.io/0/frontend/latest/check?password=$SUPERTOKENS_API_KEY&version=$version&name=web-js" \ +-H 'api-version: 0'` +if [[ $? -ne 0 ]] +then + echo "api not working... exiting!" + exit 1 +fi +if [[ `echo $isLatest | jq .isLatest` == "true" ]] +then + cd .. + npm publish --tag latest +else + cd .. + npm publish --tag version-$version +fi