Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy a specific directory to npm with Travis-CI

Tags:

npm

travis-ci

I want to deploy the dist folder after success. But instead, it keeps deploying the whole repository.

What I want to achieve is the same effect with:

npm publish dist

Here is the related part from my .travis.yml:

deploy:
  provider: npm
  email: [email protected]
  api_key:
    secure: MyApiKey
  skip_cleanup: true
  file_glob: true
  file: "dist/**/*"
  on:
    tags: true
    repo: salemdar/angular2-cookie
like image 462
s.alem Avatar asked Mar 18 '16 13:03

s.alem


1 Answers

The solution is to use before_deploy script and go to your folder.

Just make sure you have include your package.json in your folder and skip_cleanup option to true.

There is a fonctional solution:

language: node_js
node_js:
  - '5'
  - '4'
after_success:
  - npm run build #make a dist folder
before_deploy:
  - cd dist
deploy:
  provider: npm
  email: [email protected]
  skip_cleanup: true
  api_key:
    secure: ##your_secure_key
  on:
    branch: master
    tags: true
    repo: loveindent/stateful-api-mock-server
like image 122
Hikkyu Avatar answered Sep 23 '22 05:09

Hikkyu