I am switching from Jenkins to Travis CI. In Jenkins, I did not have to write a script to push my Java/android library to Git master branch. With Travis, all my research shows that I need to write a custom bash script to execute in after_success
.
this is my deploy.sh
#!/bin/bash
rev=$(git rev-parse --short HEAD)
git config user.name "uname"
git config user.password "password"
git add .
git commit -m "travis commit at ${rev}"
git push origin master
and my .travis.yml
branches:
only:
- development
language: android
sudo: false
android:
components:
- build-tools-22.0.1
- android-22
script:
- cd appdir
- ./gradlew test
after_success:
- cd ..
- ./deploy.sh
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
under the script
section, I cd
from root dir to my appdir
and run tests from there (successfully) then in the after_success
section, I cd
back into root where my deploy.sh
is located and call it.
My travis console shows everything is successful but I don't see any change in my master branch.
What am I doing wrong?