Deploy to npm

justin's Avatar

justin

03 Apr, 2015 10:32 AM

I would like to deploy to a private npm registry after a successful build. I am using the build version to bump the package version and make commits and would like it to finally deploy to npm.

The problem is that I need to first call npm adduser

version: 0.0.{build}
skip_commits:
  message: /^v(\.?[0-9]+)+$/g       # Regex for matching version commit messages
on_success:
  - git config --global credential.helper store
  - ps: Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token):x-oauth-basic@github.com`n"
  - git push
  - npm version %version% -m 'v%version%'
  - npm pack
  # npm adduser ?
  - npm publish

But the npm adduser command is interactive and I don't see a deploy option for npm. Is there any way to deploy npm package from appveyor directly?

  1. Support Staff 1 Posted by Feodor Fitsner on 03 Apr, 2015 03:44 PM

    Feodor Fitsner's Avatar

    Create adduser.txt text file with 4 lines (4 line is empty):

    <username>
    <password>
    <email>
    

    Then do:

    npm adduser < adduser.txt
    

    More about redirecting input: http://www.microsoft.com/resources/documentation/windows/xp/all/pro...

  2. 2 Posted by justin on 03 Apr, 2015 05:58 PM

    justin's Avatar

    It turns out if you do npm adduser and enter the values on your local machine it will create an authtoken in your .npmrc file. Just move that into the repo and then it will work.

  3. justin closed this discussion on 03 Apr, 2015 05:58 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac