cmfy 0.3.0

A CLI companion app for Comfy UI
Documentation
name: CI Build and Pre-release

on:
  push:
    branches:
      - '**'
    tags:
      - ''
  pull_request:


env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: "-Dwarnings"

jobs:
  build:
    runs-on: ${{ matrix.os }}

    strategy:
      fail-fast: true
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Build with default feature
        run: cargo build -r --workspace
      - name: Display workspace contents
        run: ls target/release
      - name: Archive artifacts
        uses: actions/upload-artifact@v4
        with:
          if-no-files-found: error
          name: cmfy-${{ matrix.os }}
          path: target/release/${{ matrix.os == 'windows-latest' && 'cmfy.exe' || 'cmfy' }}

  check:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout out repository
        uses: actions/checkout@v4
      - name: Run Clippy
        run: cargo clippy --workspace --all-targets --all-features --tests
      - name: Check formatting
        run: cargo fmt --all

  release:
    runs-on: ubuntu-latest
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    permissions:
      contents: write
    needs: [build, check]
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Get commit id
        run: |
          commit_id=$(git rev-parse --short HEAD)
          echo "commit_id=$commit_id" >> $GITHUB_OUTPUT
        id: get_commit_id
      - name: Download ubuntu binary
        uses: actions/download-artifact@v4
        with:
          name: cmfy-ubuntu-latest
          path: artifacts/ubuntu/
      - name: Download macos binary
        uses: actions/download-artifact@v4
        with:
          name: cmfy-macos-latest
          path: artifacts/macos/
      - name: Download windows binary
        uses: actions/download-artifact@v4
        with:
          name: cmfy-windows-latest
          path: artifacts/windows/
      - name: Rename artifacts
        run: |
          mkdir -p dist/
          mv artifacts/windows/cmfy.exe dist/cmfy-win_x86_64.exe
          mv artifacts/ubuntu/cmfy dist/cmfy-linux_x86_64
          mv artifacts/macos/cmfy dist/cmfy-macos_x86_64
      - name: Display structure of downloaded files
        run: ls -R artifacts
      - name: Generate Changelog
        run: |
          echo "" > CHANGELOG.md
      - name: Create pre-release
        id: create_release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh release delete "ci" \
              --cleanup-tag \
              --yes \
              || echo "Release does not exist yet"
          gh release create "ci" \
              -F CHANGELOG.md \
              --prerelease \
              dist/*