~evanj/cms

ref: wip/cache/listicles cms/.build.yml -rw-r--r-- 1.4 KiB
2171152dEvan M Jones WIP 4 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
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 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 "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 "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
        ssh -o 'StrictHostKeyChecking=no' evan@140.82.14.80 'bash -c "sudo systemctl restart cms.tip"'
      else 
        echo "not deploying"
      fi