~evanj/cms

66aa25a73037f63c2e83b7dc6ee6f5e48dc2b4e5 — Evan M Jones 1 year, 3 months ago 7e0c364
Feat(.build.yml): Switch to debian/testing for builds (go 1.14). Only
deploy if on master branch.
1 files changed, 11 insertions(+), 11 deletions(-)

M .build.yml
M .build.yml => .build.yml +11 -11
@@ 1,23 1,23 @@
image: ubuntu/latest
arch: amd64
image: debian/testing
packages:
  - make
  - golang
sources:
  - https://git.sr.ht/~evanj/cms
secrets:
  - 0154a9d3-f2c9-4ee2-8102-7c4c92492149
tasks:
  - build: |
      # go setup.
      wget https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz
      sudo tar -C /usr/local -xzf go1.14.4.linux-amd64.tar.gz
      mkdir -p "$HOME/go/bin"
      export PATH="$PATH:$PATH:/usr/local/go/bin:$HOME/go/bin"
      # cms build.
      export PATH=$PATH:$HOME/go/bin
      cd cms
      touch .env
      make gen
      make build
      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
      ssh -o 'StrictHostKeyChecking=no' evan@140.82.14.80 'bash -c "sudo systemctl restart cms"'
      if [ `git branch | head -n 1 | awk '{print$5}' | sed 's/)//g' | xargs -I X bash -c "git log --pretty=oneline origin/master | 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
        ssh -o 'StrictHostKeyChecking=no' evan@140.82.14.80 'bash -c "sudo systemctl restart cms"'
      else 
        echo "not deploying"
      fi