Skip to content

Commit

Permalink
Merge pull request #87 from TNG/fix-npm-token
Browse files Browse the repository at this point in the history
chore: fix usage of npm token
  • Loading branch information
alexzurbonsen authored Jan 18, 2025
2 parents 95e0149 + a598485 commit b8d2597
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_ACCESS_TOKEN}
15 changes: 7 additions & 8 deletions scripts/publish_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

set -euf -o pipefail

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

TOKEN=$1

SCRIPT_LOCATION=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")
PACKAGE_JSON="${SCRIPT_LOCATION}/../package.json"
VERSION=$(jq -r '.version' ${PACKAGE_JSON})
NPM_ACCESS_TOKEN=$1
VERSION=$(npm pkg get version)

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

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

echo
Expand Down

0 comments on commit b8d2597

Please sign in to comment.