name: build

on:
  push:
    branches: [ "main" ]
    paths-ignore: 'README.md'
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always

jobs:
  build-linux:
    runs-on: ubuntu-latest
    name: Build Linux
    steps:
      - uses: actions/checkout@v4
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install libasound2-dev libgtk-3-dev libsqlite3-dev
      - uses: Swatinem/rust-cache@v2
      - run: cargo rel --verbose
      - name: Prepare directory to upload as an artifact
        run: |
          mkdir zip
          mkdir zip/OCP
          mkdir zip/OCP/include
          cp -R include/pieces zip/OCP/include/
          cp LICENSE zip/OCP/
          cp README.md zip/OCP/
          cp target/x86_64-unknown-linux-gnu/release/OCP zip/OCP/
      - uses: actions/upload-artifact@v4
        with:
          name: linux-release-bin
          path: zip/
          include-hidden-files: true
