0

I have a repository (on GitHub) consisting of a number of modules that can be added to the main project as plugins. I want to set up the repository such that an automatic PyPI deployment is triggered (only for the changed module) every time a pull request is accepted.

Is there any way to achieve this?

Travis-CI supports automatic PyPI deployments but for the entire repository. I need it only for a folder inside the repo (a module).

jub0bs
  • 60,866
  • 25
  • 183
  • 186
Ibrahim
  • 287
  • 1
  • 3
  • 13
  • 1
    Have you looked into [git submodules](http://stackoverflow.com/questions/4611512/is-there-a-way-to-make-git-pull-automatically-update-submodules) or [git subtree](https://github.com/apenwarr/git-subtree/)? – gaborous Mar 17 '16 at 13:18
  • @gaborous To use git submodules or git subtree I'll have to keep each module into its own git repository. I want to keep all modules in one repository. All issues go to the same repo as well as all PR. – Ibrahim Mar 17 '16 at 13:41
  • no, not with git subtree, your modules will stay on the same repository. – gaborous Mar 19 '16 at 11:12

1 Answers1

1

You can use the after_success: option to implement custom deployments on travis-ci.

Something like:

after_success:
    "cd $subfolder && python setup.py sdist upload -r pypi"

You will have to provide your pypi credentials yourself using whichever method you find best.

Josh J
  • 6,813
  • 3
  • 25
  • 47
  • I want to trigger the deployment after the PR has been merged to the master. If I used your command Travis would deploy it every time a PR is received. – Ibrahim Mar 17 '16 at 14:09
  • You can use `$TRAVIS_PULL_REQUEST` and `TRAVIS_BRANCH` to determine if it is a merge into master. The first should be the string value `false` and the second should be `master`. – Josh J Mar 17 '16 at 14:51
  • @Ibrahim here is a list of all environment variables you can use to determine if it is the right branch / etc to perform a pypi update https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables – Josh J Mar 17 '16 at 14:53
  • Thanks. I'll try it out and report back. – Ibrahim Mar 17 '16 at 15:27