~evanj/cms

f1a6c83c06328ef234699c765e30bbf70dbafd7c — Evan M Jones 1 year, 2 months ago 10de0b3
Feat(.build.yml): Perform database backup on deploys.
1 files changed, 2 insertions(+), 0 deletions(-)

M .build.yml
M .build.yml => .build.yml +2 -0
@@ 14,12 14,14 @@ tasks:
      make setup gen build
      if [ `git branch | head -n 1 | awk '{print$5}' | sed 's/)//g' | xargs -I X bash -c "git log --pretty=oneline origin/master | head -n 1 | grep X" | wc -l` == "1" ]; then
        echo "deploying to production"
        ssh -o 'StrictHostKeyChecking=no' evan@140.82.14.80 'bash -c "sudo mysqldump cms > \$(mktemp --suffix .cms.datbase.backup.sql)"'
        ssh -o 'StrictHostKeyChecking=no' evan@140.82.14.80 'bash -c "rm ~/cms/cms 2>/dev/null"'
        scp -o 'StrictHostKeyChecking=no' cms evan@140.82.14.80:~/cms
        scp -r -o 'StrictHostKeyChecking=no' static evan@140.82.14.80:~/cms
        ssh -o 'StrictHostKeyChecking=no' evan@140.82.14.80 'bash -c "sudo systemctl restart cms"'
      elif [ `git branch | head -n 1 | awk '{print$5}' | sed 's/)//g' | xargs -I X bash -c "git log --pretty=oneline origin/tip | head -n 1 | grep X" | wc -l` == "1" ]; then
        echo "deploying to tip"
        ssh -o 'StrictHostKeyChecking=no' evan@140.82.14.80 'bash -c "sudo mysqldump cms_tip > \$(mktemp --suffix .cms.tip.datbase.backup.sql)"'
        ssh -o 'StrictHostKeyChecking=no' evan@140.82.14.80 'bash -c "rm ~/cms.tip/cms 2>/dev/null"'
        scp -o 'StrictHostKeyChecking=no' cms evan@140.82.14.80:~/cms.tip
        scp -r -o 'StrictHostKeyChecking=no' static evan@140.82.14.80:~/cms.tip