uddf-sdk 0.2.1

Reading and writing UDDF files
Documentation
name: Release

on:
  pull_request:
    types:
      - closed
    branches:
      - main
  workflow_dispatch:

concurrency: ${{ github.workflow }}-${{ github.ref }}

env:
  CARGO_TERM_COLOR: always

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Check FMT
        run: cargo fmt -- --check

  test:
    strategy:
      matrix:
        platform:
          - ubuntu-latest
          # - windows-latest
    runs-on: ${{ matrix.platform }}
    steps:
      - uses: actions/checkout@v4

      - name: Run tests
        run: cargo test --verbose

  # build-artifacts:
  #   if: github.head_ref == 'release' && github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
  #   needs:
  #     - lint
  #     - test
  #   strategy:
  #     fail-fast: false
  #     matrix:
  #       include:
  #         - target: x86_64-unknown-linux-musl
  #           os: ubuntu-latest
  #         - target: x86_64-apple-darwin
  #           os: macos-latest
  #         - target: aarch64-apple-darwin
  #           os: macos-latest
  #         - target: x86_64-pc-windows-msvc
  #           os: windows-latest
  #   env:
  #     archive_name: artifact

  #   runs-on: ${{ matrix.os }}
  #   name: ${{ matrix.target }}

  #   steps:
  #     - uses: actions/checkout@v4
  #     - uses: Swatinem/rust-cache@v2
  #     - name: Install host target
  #       run: rustup target add ${{ matrix.target }}

  #     - name: Install musl-tools
  #       if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
  #       run: sudo apt-get install -y musl-tools

  #     - name: Build
  #       run: cargo build --release --target ${{ matrix.target }}

  #     - name: Set archive name (non-Windows)
  #       id: archive
  #       run: echo "archive_name=uddf-sdk-${{ matrix.target }}" >> $GITHUB_ENV

  #     - name: Set archive name (Windows)
  #       if: ${{ matrix.os == 'windows-latest' }}
  #       run: echo "archive_name=uddf-sdk-${{ matrix.target }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append

  #     - name: Create archive folder
  #       run: mkdir ${{ env.archive_name }}

  #     - name: Copy Unix artifact
  #       if: ${{ matrix.os != 'windows-latest' }}
  #       run: cp target/${{ matrix.target }}/release ${{ env.archive_name }}

  #     - name: Upload artifact
  #       uses: actions/upload-artifact@v4
  #       with:
  #         name: ${{ matrix.target }}
  #         path: ${{ env.archive_name }}.tgz
  #         if-no-files-found: error

  release:
    needs:
      - lint
      - test
      # - build-artifacts
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      # - uses: actions/download-artifact@v4
      #   with:
      #     path: artifacts
      #     merge-multiple: true
      - uses: knope-dev/action@v2.1.0
        with:
          version: 0.13.0
      - run: knope release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  publish-crate:
    needs:
      - release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: Swatinem/rust-cache@v2
      - uses: katyo/publish-crates@v2
        with:
          registry-token: ${{ secrets.CRATES_TOKEN }}