Skip to content

Commit

Permalink
Move ssh settings to deploy script.
Browse files Browse the repository at this point in the history
  • Loading branch information
IRus committed Jul 6, 2018
1 parent d7b13a6 commit 31d823b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ addons:
before_script:
- nvm install 8
- yarn install
- openssl aes-256-cbc -K $encrypted_83630750896a_key -iv $encrypted_83630750896a_iv -in deploy@morty.enc -out ~/.ssh/deploy@morty -d
- chmod 600 ~/.ssh/deploy@morty
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/deploy@morty
script:
- bash ./deploy.sh
- ./gradlew check installDist
deploy:
- provider: script
script: bash ./deploy.sh
on:
branch: master
cache:
yarn: true
directories:
Expand Down
31 changes: 14 additions & 17 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
#!/bin/bash
set -e # exit with nonzero exit code if anything fails

echo "TRAVIS_BRANCH=${TRAVIS_BRANCH}"
echo "TRAVIS_BUILD_DIR=${TRAVIS_BUILD_DIR}"
echo "TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST}"

# If current branch not "master" or it's PR
if [ "${TRAVIS_BRANCH}" = "master" ] && [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
echo "Clear and re-create the dist directory...";
rm -rf dist || exit 1;
echo "Clear and re-create the dist directory...";
rm -rf dist || exit 1;

echo "Run kotlin application to generate various data...";
./gradlew installDist
AWESOME_KOTLIN_OPTS="-Xmx2g" ./build/install/awesome-kotlin/bin/awesome-kotlin true
echo "Run kotlin application to generate various data...";
AWESOME_KOTLIN_OPTS="-Xmx2g" ./build/install/awesome-kotlin/bin/awesome-kotlin true

echo "Build React Application...";
npm run pack
echo "Build React Application...";
npm run pack

echo "Sync with remote folder..."
rsync -r --delete-after --quiet "${TRAVIS_BUILD_DIR}/dist/" deploy@kotlin.link:~/files/kotlin.link
else
echo "Deploy only on master branch. Current branch: \"${TRAVIS_BRANCH}\".";
exit 0;
fi
echo "Add ssh key to remote server..."
openssl aes-256-cbc -K $encrypted_83630750896a_key -iv $encrypted_83630750896a_iv -in deploy@morty.enc -out ~/.ssh/deploy@morty -d
chmod 600 ~/.ssh/deploy@morty
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/deploy@morty

echo "Sync with remote folder..."
rsync -r --delete-after --quiet "${TRAVIS_BUILD_DIR}/dist/" deploy@kotlin.link:~/files/kotlin.link

0 comments on commit 31d823b

Please sign in to comment.