1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-12-27 00:31:35 +01:00
foris-js/scripts/publish.sh

24 lines
654 B
Bash
Raw Permalink Normal View History

2019-10-07 17:16:27 +02:00
#!/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 "-"
2019-10-22 10:24:10 +02:00
echo "//registry.npmjs.org/:_authToken=$(echo "$NPM_TOKEN" | tr _ -)" > .npmrc
2019-10-07 17:16:27 +02:00
echo "unsafe-perm = true" >> ~/.npmrc
if test "$1" = "beta"
then
2019-10-22 10:24:10 +02:00
BETA_VERSION=$(npx -c 'echo "$npm_package_version"')-beta.$CI_COMMIT_SHORT_SHA
npm version "$BETA_VERSION" --git-tag-version false
2019-10-07 17:16:27 +02:00
npm publish --tag beta
elif test "$1" = "latest"
then
npm publish
else
echo "Usage: publish.sh [ beta | latest ]"
exit 1
fi
fi