- encrypt your sonatype oss password with
travis encrypt -r user/repo SONATYPE_PASSWORD=pass
- put addServer.py somewhere in your repository
- add the relevant lines to your .travis.yml
Deployment will only happen when the build was successful and the encrypted variables are available (= no deployment for pull requests etc.). If the deployment itself was unsuccessful, then the build still passes.
If you only want to deploy for certain branches, use shell scripting like:
after_success:
- "[[ $TRAVIS_BRANCH == \"master\" ]] && { python travis/addServer.py; mvn clean deploy --settings ~/.m2/mySettings.xml; };"
Warning: This will deploy multiple times if you use the matrix functionality, see the issue.