name: Deployment Build

on: [workflow_dispatch]

env:
  CARGO_TERM_COLOR: always

jobs:
  deploy:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [macOS-latest, windows-2019, ubuntu-latest]
        include:
          - os: ubuntu-latest
            command: |
                sudo apt-get update && sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev libgtk-3-dev
                cd postsack-native
                cargo install cargo-bundle
                ./build_linux.sh
            binary: target/release/bundle/deb/postsack_1.0.0_amd64.deb
          - os: macOS-latest
            command: |
                cd postsack-native
                rustup target add aarch64-apple-darwin
                rustup target add x86_64-apple-darwin
                cargo install cargo-bundle
                ./build_mac.sh
            binary: target/postsack.zip
          - os: windows-2019
            command: |
                cd postsack-native
                .\build_windows.bat
            binary: target\release\postsack
    steps:
      - name: Production Build
        uses: actions/checkout@v2
      - run: ${{ matrix.command }}
      - name: Archive production artifacts
        uses: actions/upload-artifact@v2
        with:
          name: dist
          path: ${{ matrix.binary }}