Skip to content

Instantly share code, notes, and snippets.

@branflake2267
Last active April 6, 2019 05:19
Show Gist options
  • Save branflake2267/c9555cf3cf4c2c73682652538a6bda68 to your computer and use it in GitHub Desktop.
Save branflake2267/c9555cf3cf4c2c73682652538a6bda68 to your computer and use it in GitHub Desktop.
Teamcity Sencha NPM Login Method. This Generates the ~/.npmrc login credentials.
# Build step
# You can replicate this by running `npm login --registry=https://npm.sencha.com --scope=@sencha` on your system.
# Get your authtoken by logging in on your system and finding the auth token in ~/.npmrc.
# Remove previous file
rm -f ~/.npmrc
# Write new ~/.npmrc
echo "Writing auth tokens to ~/.npmrc"
echo "@sencha:registry=http://npm.sencha.com" >> ~/.npmrc
echo "//npm.sencha.com/:_authToken=%npm.sencha.com-authtoken%" >> ~/.npmrc
# Debug
echo "Debug contents of ~/.npmrc:"
echo "~~~~~~~~~~~~~~~~~~~~~~"
cat ~/.npmrc
echo "~~~~~~~~~~~~~~~~~~~~~~"
# Check login with whoami
echo "Invoking NPM whoami"
echo "~~~~~~~~~~~~~~~~~~~~~~"
npm --registry http://npm.sencha.com/ whoami
echo "~~~~~~~~~~~~~~~~~~~~~~"
@branflake2267
Copy link
Author

branflake2267 commented Feb 21, 2019

TeamCity Variable: %npm.sencha.com-authtoken% - It doesn't have to be a variable.
Replace: %npm.sencha.com-authtoken% with your token from the account you want to use. I copy the token from my local ~/.npmrc file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment