name: Build Spotty for all platforms

on: [workflow_dispatch]

env:
  CARGO_TERM_COLOR: always
  KEYMASTER_CLIENT_ID: ${{ secrets.KEYMASTER_CLIENT_ID }}

jobs:
  macOS:
    runs-on: macos-10.15

    steps:
    - name: Install Rust
      uses: actions-rs/toolchain@v1
      with:
          toolchain: stable

    - name: Checkout
      uses: actions/checkout@v2

    - name: Write Build Configuration File
      uses: DamianReeves/write-file-action@v1.0
      with:
        path: ./src/client_id.txt
        contents: ${{ env.KEYMASTER_CLIENT_ID }}
        write-mode: overwrite

    - name: Build
      run: cargo build --release && strip target/release/spotty

    - name: Upload artifacts
      uses: actions/upload-artifact@v2
      with:
        name: spotty-mac
        path: target/release/spotty

  Linux:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v1

    - name: Write Build Configuration File
      uses: DamianReeves/write-file-action@v1.0
      with:
        path: ./src/client_id.txt
        contents: ${{ env.KEYMASTER_CLIENT_ID }}
        write-mode: overwrite

    - name: Build ARMv7
      run: docker run --rm -v $(pwd):/source dlecan/rust-crosscompiler-arm:stable

    - name: Build other binaries (x86_64, i686, ARMv8)
      run: ./xbuild.sh

    - name: Upload artifacts
      uses: actions/upload-artifact@v2
      with:
        name: spotty-linux
        path: releases/

  windows:
    runs-on: windows-2019

    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Write Build Configuration File
      uses: DamianReeves/write-file-action@v1.0
      with:
        path: ./src/client_id.txt
        contents: ${{ env.KEYMASTER_CLIENT_ID }}
        write-mode: overwrite

    - name: Build
      run: cargo build --release

    - name: Upload artifacts
      uses: actions/upload-artifact@v2
      with:
        name: spotty.exe
        path: target/release/spotty.exe
Add workflow for all platforms
Add workflow for all platforms
