name: Build

on:
  push:
    branches: [dev, master]
    paths-ignore:
      - docs/**
      - "**schema**"
  pull_request:
  workflow_dispatch:
  
env:
  GH_ACTIONS: 'true'

jobs:
  build:
    runs-on: windows-latest
    steps:

    - uses: actions/checkout@v2
        
    # Set to Release if we're in master, otherwise keep us in Debug
    - name: Set Release
      if: github.ref == 'refs/heads/master'
      run: echo "BUILD_TYPE=Release" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
      
    - name: Set Debug
      if: github.ref != 'refs/heads/master'
      run: echo "BUILD_TYPE=Debug" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
    
    - uses: actions/setup-dotnet@v1
    - run: dotnet build -c $Env:BUILD_TYPE -o .\NewHorizons\Bin\$Env:BUILD_TYPE
    - uses: actions/upload-artifact@v2
      with:
        name: NewHorizons-${{ env.BUILD_TYPE }}
        path: .\NewHorizons\Bin\${{ env.BUILD_TYPE }}
