travis-auto-deploy.sh (2030B)
1 #!/bin/sh 2 set -e 3 set +x 4 if test "$(git config remote.origin.url)" != "https://github.com/jsmaniac/scribble-mathjax.git"; then 5 echo "Not on official repo, will not deploy gh-pages." 6 elif test "$TRAVIS_PULL_REQUEST" != "false"; then 7 echo "This is a Pull Request, will not deploy gh-pages." 8 elif test "$TRAVIS_BRANCH" != "v2.6-racket-mini-source"; then 9 echo "Not on v2.6-racket-mini-source branch (TRAVIS_BRANCH = $TRAVIS_BRANCH), will not deploy gh-pages." 10 elif test -z "${encrypted_675a73236f08_key:-}" -o -z "${encrypted_675a73236f08_iv:-}"; then 11 echo "Travis CI secure environment variables are unavailable, will not deploy gh-pages." 12 else 13 set -x 14 echo "Automatic push to gh-pages" 15 ls -l /home/travis/build/jsmaniac/scribble-mathjax/.git/index.lock || true 16 17 # Git configuration: 18 git config --global user.name "$(git log --format="%aN" HEAD -1) (Travis CI automatic commit)" 19 git config --global user.email "$(git log --format="%aE" HEAD -1)" 20 21 # SSH configuration 22 mkdir -p ~/.ssh 23 chmod 700 ~/.ssh 24 set +x 25 if openssl aes-256-cbc -K $encrypted_675a73236f08_key -iv $encrypted_675a73236f08_iv -in travis-deploy-key-id_rsa.enc -out travis-deploy-key-id_rsa -d >/dev/null 2>&1; then 26 echo "Dectypred key successfully." 27 else 28 echo "Error while decrypting key." 29 fi 30 mv travis-deploy-key-id_rsa ~/.ssh/travis-deploy-key-id_rsa 31 set -x 32 chmod 600 ~/.ssh/travis-deploy-key-id_rsa 33 set +x 34 eval `ssh-agent -s` 35 set -x 36 ssh-add ~/.ssh/travis-deploy-key-id_rsa 37 38 39 npm install grunt grunt-cli grunt-contrib-clean grunt-regex-replace 40 PATH="$PWD/node_modules/grunt-cli/bin:$PATH" grunt racket-mini 41 git add -A . >/dev/null 2>&1 42 git rm -f .gitignore || true 43 git rm -f Gruntfile.js || true 44 git rm -f travis-deploy-key-id_rsa.enc || true 45 git rm -f travis-auto-deploy.sh || true 46 git commit -m "auto-commit" >/dev/null 2>&1 47 git log --oneline --decorate --graph -10 48 git push --force --quiet "git@github.com:jsmaniac/scribble-mathjax.git" HEAD:refs/heads/v2.6-racket-mini > /dev/null 2>&1 49 fi