name: Build and Publish

on:
  push:
    branches:
      - main  # Adjust to your main branch name

jobs:
  build:
    runs-on: ubuntu-latest  # You can specify different OS and platforms here

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

    - name: Set up CMake
      uses: actions/setup-cmake@v2
      with:
        cmake-version: 3.x  # Specify your desired CMake version

    - name: Build and Test (Linux)
      run: |   mkdir build
        cd build
        cmake ..
        make
        ctest

    - name: Publish Artifact (Linux)
      if: success()
      uses: actions/upload-artifact@v2
      with:
        name: my-library-linux
        path: build/my-library  # Adjust the path and artifact name

  build-windows:
    runs-on: windows-latest  # You can specify different OS and platforms here

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

    - name: Set up CMake
      uses: actions/setup-cmake@v2
      with:
        cmake-version: 3.0  # cmake version

    - name: Build and Test (Windows)
      run: |   mkdir build
        cd build
        cmake ..
        cmake --build . --config Release
        ctest

    - name: Publish Artifact (Windows)
      if: success()
      uses: actions/upload-artifact@v2
      with:
        name: my-library-windows
        path: build/Release/my-library.exe  # Adjust the path and artifact name

# Add similar steps for other platforms (e.g., macOS)

# Define deployment steps here to release your library artifacts
