Support deploying to GitHub package registry

Similar to https://docs.travis-ci.com/user/deployment/npm/, I’d like travis to allow uploading packages to the new GitHub package registry (https://github.com/features/package-registry)

Alternatively, add a registry option to the npm (and others?) deployment configuration that can be set to the GitHub registry.

For example:

deploy:
  - provider: npm
    email: my@email
    registry: npm.pkg.github.com
    api_key:
      secure: SOMEKEY

I do not want to use publishConfig.registry in my package.json flie because that would force me to choose between npm and GitHub, I’d like to publish to both.

Looks like it’s meant to be a drop-in API-compat replacement, so the latter makes sense.

dpl v2 has an option registry https://github.com/travis-ci/dpl/blob/master/lib/dpl/providers/npm.rb#L17. (dpl v2 is the not yet released next major version.)

We haven’t tested this with GitHub’s package registry, yet, but if you want to give it a try that feedback would be very appreciated.

You can opt into using

deploy:
  - provider: npm
    edge: true
1 Like

Setting the registry did not seem to work for me.

  - provider: npm
    email: info@saturnserver.org
    edge: true
    registry: https://npm.pkg.github.com
    api_key:
        secure: <REDACTED>
    tag: next
    skip_cleanup: true
    on:
        branch: master
        repo: Ionaru/array-utils

Full file: https://github.com/Ionaru/array-utils/blob/master/.travis.yml

Relevant travis log: https://travis-ci.org/Ionaru/array-utils/jobs/575246552

Deployment to NPM succeeded, but deployment to GitHub failed with this error:

401 Unauthorized - PUT https://registry.npmjs.org/@ionaru%2farray-utils - You must be logged in to publish packages.

Looks like it was still trying to deploy to the NPM registry instead of GitHub.

Any suggestions?

Thanks for testing. I’m sorry that it hasn’t worked yet. Could you try this configuration now?

deploy:
  - provider: npm
    edge:
      branch: master
    ⋮ # rest

As you did with the previous test, I ask that you put this extra bits on all deployment definitions, since mixing up released dpl and pre-release may not function well.

Thanks!

1 Like

That worked! Thank you very much for your help.

Is there a timetable for when we can expect this functionality to be released?

1 Like

Thanks for trying this out! And sorry about the wrong edge config. I didn’t realize true wouldn’t work.

We are planning to do a developer preview release very soon, but that won’t enable this version by default, just yet. We don’t have a final release date for when it become the default.