name: Cabin CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-go@v2
    - name: Install SSH Key
      uses: shimataro/ssh-key-action@v2
      with:
        key: ${{ secrets.SSH_PRIVATE_KEY }}
        known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
    - name: Adding Known Hosts
      run: ssh-keyscan -H thanksgiving.dinnen.engineering >> ~/.ssh/known_hosts
    - name: Stop Pi
      run: ssh pi@thanksgiving.dinnen.engineering "sudo systemctl stop analyzer"
    - name: Build Arduino
      run: |
        ssh pi@thanksgiving.dinnen.engineering "cd /home/pi/Thanksgiving_Intranet/Arduino_Software; git pull; make"
    - name: Build Analyzer
      run: |
        cd analyzer
        export PATH=$PATH:$(go env GOPATH)/bin
        make compile
        rsync -z --progress ./build/analyzer-linux-arm-5 pi@thanksgiving.dinnen.engineering:~/go/bin/analyzer
    - name: Start Pi
      run: ssh pi@thanksgiving.dinnen.engineering "sudo systemctl start analyzer"

name: Cabin CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-go@v2
    - name: Install SSH Key
      uses: shimataro/ssh-key-action@v2
      with:
        key: ${{ secrets.SSH_PRIVATE_KEY }}
        known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
    - name: Adding Known Hosts
      run: ssh-keyscan -H thanksgiving.dinnen.engineering >> ~/.ssh/known_hosts
    - name: Stop Pi
      run: ssh pi@thanksgiving.dinnen.engineering "sudo systemctl stop analyzer"
    - name: Build Arduino
      run: |
        ssh pi@thanksgiving.dinnen.engineering "cd /home/pi/Thanksgiving_Intranet/Arduino_Software; git pull; make"
    - name: Build Analyzer
      run: |
        cd analyzer
        export PATH=$PATH:$(go env GOPATH)/bin
        make compile
        rsync -z --progress ./build/analyzer-linux-arm-5 pi@thanksgiving.dinnen.engineering:~/go/bin/analyzer
        cd ..
    - name: Build Frontend
      run: |
        cd frontend
        yarn
        yarn build
        yarn upload
    - name: Start Pi
      run: ssh pi@thanksgiving.dinnen.engineering "sudo systemctl start analyzer"

Build and upload frontend via CI
Build and upload frontend via CI
