1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-10-04 12:14:19 +02:00
foris-js/scripts/publish.sh
2019-11-01 09:28:28 +00:00

24 lines
676 B
Bash
Executable File

#!/bin/sh
if test -z "$NPM_TOKEN"
then
echo "\$NPM_TOKEN is not set"
exit 1
else
# Need to replace "_" with "-" as GitLab CI won't accept secret vars with "-"
echo "//registry.npmjs.org/:_authToken=$(echo "$NPM_TOKEN" | tr _ -)" > .npmrc
echo "unsafe-perm = true" >> ~/.npmrc
if test "$1" = "beta"
then
BETA_VERSION=$(npx -c 'echo "$npm_package_version"')-beta.$CI_COMMIT_SHORT_SHA
npm version "$BETA_VERSION" --git-tag-version false
cd dist && npm publish --tag beta
elif test "$1" = "latest"
then
cd dist && npm publish
else
echo "Usage: publish.sh [ beta | latest ]"
exit 1
fi
fi