diff --git a/.travis.yml b/.travis.yml index c4c698f9..2fe97bce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,22 +5,26 @@ services: - mongodb cache: directories: - - node_modules + - node_modules git: depth: 3 +install: + - git clone $GIT_CLONE_REMOTE + - cd $REPO_NAME + - git checkout $TRAVIS_BRANCH + - npm i script: npm run travis-script after_script: - npm report-coverage before_script: - npm install -g gulp-cli +before_deploy: + - if [ "$TRAVIS_BRANCH" == "develop" ] ; then if [ "$TRAVIS_PULL_REQUEST" == "false"] ; then bash travis.sh ; fi ; fi deploy: - app: $APP_NAME + app: $PROVIDER_APP_NAME provider: $PROVIDER on: - repo: surabhi226005/express-mongoose-es6-rest-api - branch: release + repo: $PROVIDER_REPO_NAME + all_branches: true api_key: secure: $TRAVIS_SECURE_API_KEY -after_success: - - if [ "$TRAVIS_BRANCH" == "develop" ] ; then - if [ "$TRAVIS_PULL_REQUEST" == "false" ] ; then bash travis.sh ; fi ; fi diff --git a/config/config.js b/config/config.js index 3ca2c9ff..2df9fc58 100644 --- a/config/config.js +++ b/config/config.js @@ -18,10 +18,8 @@ const envVarsSchema = Joi.object({ }), JWT_SECRET: Joi.string().required() .description('JWT Secret required to sign'), - MONGO_HOST: Joi.string().required() - .description('Mongo DB host url'), - MONGO_PORT: Joi.number() - .default(27017) + MONGODB_URI: Joi.string().required() + .description('Mongo DB host url') }).unknown() .required(); @@ -36,8 +34,7 @@ const config = { mongooseDebug: envVars.MONGOOSE_DEBUG, jwtSecret: envVars.JWT_SECRET, mongo: { - host: envVars.MONGO_HOST, - port: envVars.MONGO_PORT + host: envVars.MONGODB_URI } }; diff --git a/travis.sh b/travis.sh index c7197e63..d463d764 100644 --- a/travis.sh +++ b/travis.sh @@ -1,36 +1,38 @@ -# vi /etc/ssh/ssh_config -# i Host 192.168.0.* StrictHostKeyChecking no UserKnownHostsFile=/dev/null - -# cd ~/.ssh -# rm known_hosts -# ln -s /dev/null known_hosts - git config --global user.name "$GIT_USER_NAME" + git config --global user.email $GIT_USER_EMAIL # Install the Heroku gem (or the Heroku toolbelt) gem install $PROVIDER + # Add your Heroku git repo: -git remote rm $PROVIDER ; +git remote rm $PROVIDER ; + git remote add $PROVIDER git@$PROVIDER.com:$PROVIDER_APP_NAME.git ; + # Add your Heroku API key: export HEROKU_API_KEY=$HEROKU_API_KEY + # Turn off warnings about SSH keys: echo " Host heroku.com" >> ~/.ssh/config + echo " StrictHostKeyChecking no" >> ~/.ssh/config + echo " CheckHostIP no" >> ~/.ssh/config + echo " UserKnownHostsFile=/dev/null" >> ~/.ssh/config + # Clear your current Heroku SSH keys: $PROVIDER keys:clear + # Add a new SSH key to Heroku yes | $PROVIDER keys:add git add dist/ ; + git checkout -b $NEW_TRAVIS_BRANCH ; -git commit -m "$TRAVIS_COMMIT_MESSAGE" ; -# Push to Heroku! -git fetch --all --unshallow -yes | git push --force $PROVIDER $NEW_TRAVIS_BRANCH:$PROVIDER_BRANCH ; +git commit -m "$TRAVIS_COMMIT_MESSAGE" ; -# echo -e "yes" | ./travis.sh +# Push to Heroku +yes | git push --force $PROVIDER $NEW_TRAVIS_BRANCH:$PROVIDER_BRANCH ;