Closed boldtrn closed 5 years ago
Thanks, I just merged this PR. Something looks wrong though, the deploy was not successful. Probably something is missing, I am currently investigating.
This is extremely weird. I set up a test repository and I can deploy there without any problems using a similar setup. For some reason it fails for this repository though. My current idea is that this is some kind of caching issues, since I switched dpl versions. I cleared the travis cache, but the issue still exists. Maybe we should wait a day or two, and see if simply restarting the build succeed. Maybe anyone has an idea what might be wrong?
I have no experience with npm. The only error I see in the logs is:
invalid option "--api_key="
Maybe there is something broken?
Yes indeed, that's the error. I think it's caused by dpl, Travis' deployment engine.
Dpl v2, has a parameter --api-token, Dpl v1 has a parameter --api-key
.
I first started with v2, then I switched to v1 and switched from token to key. Now my guess is that somehow it still tries to address v2, but the settings are set for v1.
Ok, I found the issue. I set up the travis environment variables to be only available on the master branch. If you tag a commit, travis will read the git repository like:
git clone --depth=50 --branch=0.13.0-pre2 https://github.com/graphhopper/directions-api-js-client.git graphhopper/directions-api-js-client
So it detaches the tag from the master branch and then it cannot read the environment variable any more.
This PR adds the option to automatically publish this package via travis.
Travis provides a deployment option for NPM (and others). It should be set up to only deploy on the master branch and doesn't work in pull requests. If you add a tag to a commit on master and push the tag, it should work (I couldn't test that yet).
I set the npm auth token as encrypted variable in Travis.
Before you can publish, you will need to set the version in the package.json to an unpublished version following semantic versioning. NPM does not allow to re-publish the same version, you need to increment the version every time.