Skip to content

Commit b8d2597

Browse files
Merge pull request #87 from TNG/fix-npm-token
chore: fix usage of npm token
2 parents 95e0149 + a598485 commit b8d2597

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//registry.npmjs.org/:_authToken=${NPM_ACCESS_TOKEN}

scripts/publish_release.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@
22

33
set -euf -o pipefail
44

5-
if [[ $# -ne 2 ]]; then
6-
echo "Wrong number of arguments!"
5+
if [[ $# -ne 1 ]]; then
6+
echo "Wrong number of arguments! Access token required."
77
exit 2
88
fi
99

10-
TOKEN=$1
11-
12-
SCRIPT_LOCATION=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")
13-
PACKAGE_JSON="${SCRIPT_LOCATION}/../package.json"
14-
VERSION=$(jq -r '.version' ${PACKAGE_JSON})
10+
NPM_ACCESS_TOKEN=$1
11+
VERSION=$(npm pkg get version)
1512

1613
# for prettier printing
1714
VIOLET='\033[0;35m'
@@ -37,10 +34,12 @@ echo -e "${VIOLET}Building successful${NC}"
3734
echo
3835
echo -e "${VIOLET}Create version tag${NC}"
3936
git tag -a ${VERSION} -m "Release version ${VERSION}"
40-
git push origin ${VERSION}
37+
git push --tags
4138

4239
echo
4340
echo -e "${VIOLET}Publishing package${NC}"
41+
# requires an access token, that is stored in an
42+
# environment variable with the same name as the on required in .npmrc
4443
# npm publish --access public
4544

4645
echo

0 commit comments

Comments
 (0)