~evanj/cms

cms/.build.yml -rw-r--r-- 1.7 KiB
630f31abEvan J Feat(file.go): Upload files concurrently complete. Fixed bug in E3 path 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
image: debian/testing
packages:
  - make
  - golang
sources:
  - https://git.sr.ht/~evanj/cms
secrets:
  - 0154a9d3-f2c9-4ee2-8102-7c4c92492149
tasks:
  - build: |
      export PATH=$PATH:$HOME/go/bin
      cd cms
      touch .env
      make
      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 -p 4545 -o 'StrictHostKeyChecking=no' evan@140.82.14.80 'bash -c "sudo mysqldump cms > \$(mktemp --suffix .cms.datbase.backup.sql)"'
        ssh -p 4545 -o 'StrictHostKeyChecking=no' evan@140.82.14.80 'bash -c "rm ~/cms/cms 2>/dev/null"'
        scp -P 4545 -o 'StrictHostKeyChecking=no' cms evan@140.82.14.80:~/cms
        scp -P 4545 -r -o 'StrictHostKeyChecking=no' static evan@140.82.14.80:~/cms
        ssh -p 4545 -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 -p 4545 -o 'StrictHostKeyChecking=no' evan@140.82.14.80 'bash -c "sudo mysqldump cms_tip > \$(mktemp --suffix .cms.tip.datbase.backup.sql)"'
        ssh -p 4545 -o 'StrictHostKeyChecking=no' evan@140.82.14.80 'bash -c "rm ~/cms.tip/cms 2>/dev/null"'
        scp -P 4545 -o 'StrictHostKeyChecking=no' cms evan@140.82.14.80:~/cms.tip
        scp -P 4545 -r -o 'StrictHostKeyChecking=no' static evan@140.82.14.80:~/cms.tip
        ssh -p 4545 -o 'StrictHostKeyChecking=no' evan@140.82.14.80 'bash -c "sudo systemctl restart cms.tip"'
      else 
        echo "not deploying"
      fi