chmmod-create 0.2.0

一個用於快速建立 CHM 插件模組的命令列工具
name: Build
on:
  push:
    branches:
    - "build" 
    paths:
    - src/**
    - Cargo.toml
    - '.github/workflows/build.yml'
env:
  PROJECT_NAME: 'chmmod-create'
jobs:
  build:
    runs-on: ${{ matrix.runner }}
    strategy:
      matrix:
        include:
        - name: linux-amd64
          runner: ubuntu-latest
          target: x86_64-unknown-linux-gnu
        - name: win-amd64
          runner: windows-latest
          target: x86_64-pc-windows-msvc
        - name: macos-amd64
          runner: macos-latest
          target: x86_64-apple-darwin
        - name: macos-arm64
          runner: macos-latest
          target: aarch64-apple-darwin
    steps:
    - name: Checkout
      uses: actions/checkout@v4
    - name: Install Rust
      uses: dtolnay/rust-toolchain@stable
      with:
        targets: ${{ matrix.target }}
    - name: Setup Cache
      uses: Swatinem/rust-cache@v2
    - name: Create Dist Directory
      run: mkdir -p dist
    - name: Build Library
      run: cargo build --verbose --locked --release --target ${{ matrix.target }}
    - name: Prepare Release Binary
      run: |
        BIN_SUFFIX=""
        if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
          BIN_SUFFIX=".exe"
        fi
        BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}"
        BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}"
        BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ github.ref_name }}-${{ matrix.name }}${BIN_SUFFIX}"
        mv "${BIN_OUTPUT}" "./dist/${BIN_RELEASE}" 
      shell: bash
    - name: Upload Artifact
      uses: actions/upload-artifact@v4
      with:
        name: "chmmod_create-${{ matrix.name }}"
        retention-days: 30
        path: dist/