npm / npme-installer

npm Enterprise installer
https://www.npmjs.com/enterprise
Other
35 stars 21 forks source link

GitHub Enterprise as Auth #138

Open kevinSuttle opened 8 years ago

kevinSuttle commented 8 years ago

Personal access tokens and/or deploy keys, login, CI/CD, etc.

jbaskeen commented 8 years ago

We need to be able to perform a npm publish during Travis builds desperately. Otherwise publishing is too manual and breaks CI automated workflows.

nexdrew commented 8 years ago

@jbaskeen FWIW npm Enterprise has a concept of "deploy tokens" that are meant for CI usage and do not depend on your configured auth provider like GHE.

You can create a deploy token using the npme bin on your host:

$ npme manage-tokens generate
? npm username travis-ci
? email address travis-ci@example.com
generated token: deploy_f5f54069-df3b-4d2c-8113-93b4111610cb

You could then plug this token value into an environment variable like NPM_TOKEN in your Travis settings:

screen shot 2016-06-15 at 5 55 20 pm

And use a before_install directive like the following in your Travis project config to use the env var:

language: node_js
node_js:
  - "node"
before_install:
  - printf "registry=http://npm-registry.example.com:8080/\n//npm-registry.example.com:8080/:_authToken=${NPM_TOKEN}\n" >> ~/.npmrc

This should give your CI builds access to install and publish packages from/to your npm Enterprise registry.

kevinSuttle commented 8 years ago

@nexdrew Yeah. I'm actively trying to avoid npme's deploy tokens as I'm one of 2 admins for an appliance that will most likely reach thousands of developers. @bcoe and I have had long discussions about it. :)

tvb commented 6 years ago

@nexdrew I cannot seem to get this to work with AWS CodeBuild or locally. I keep getting:

npm ERR! code ENEEDAUTH
npm ERR! need auth auth required for publishing
npm ERR! need auth You need to authorize this machine using `npm adduser`

To what AUTH settings do I need to configure my NPMe environment? I've set it to GH Auth now but that from what I understand that shouldn't matter with this deploy token..

My .npmrc looks like:

@myscope:registry=http://mydomain.com:8080/
//mydomain.com.com:8080/:_authToken=deploy_my_random_key

And the command I try to run:

npm publish --scope=@myscope --registry=http://mydomian.com:8080/
nexdrew commented 6 years ago

@tvb I no longer work for npm and thus do not have easy access to an npm Enterprise instance.

@bcoe @arobson Can one of you please help Tristan?