mdmodels 0.2.10

A tool to generate models, code and schemas from markdown files
Documentation
name: Compile and release

on:
  push:
    tags:
      - "v?[0-9]+.[0-9]+.[0-9]+"

permissions:
  contents: write

jobs:
  build-and-upload:
    name: Build and upload
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        include:
          - build: linux
            os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
          - build: macos
            os: macos-latest
            target: x86_64-apple-darwin

          - build: macos
            os: macos-latest
            target: aarch64-apple-darwin

          - build: windows
            os: windows-latest
            target: x86_64-pc-windows-msvc

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

      - name: Get the release version from the tag
        shell: bash
        run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Build
        run: cargo build --features openai --verbose --release --target ${{ matrix.target }}

      - name: Build binary
        shell: bash
        run: |
          if [ "${{ matrix.os }}" = "windows-latest" ]; then
            fname="target/${{ matrix.target }}/release/md-models-${{ matrix.target }}.exe"
            mv target/${{ matrix.target }}/release/md-models.exe $fname
            echo "ASSET=$fname" >> $GITHUB_ENV
          else
            fname="target/${{ matrix.target }}/release/md-models-${{ matrix.target }}"
            mv target/${{ matrix.target }}/release/md-models $fname
            echo "ASSET=$fname" >> $GITHUB_ENV
          fi

      - name: Release
        uses: softprops/action-gh-release@v1
        with:
          files: |
            ${{ env.ASSET }}