zhconv 0.4.1

Traditional, Simplified and regional Chinese variants converter powered by MediaWiki & OpenCC rulesets and the Aho-Corasick algorithm 中文简繁及地區詞轉換
Documentation
name: "Release"

on:
  push:
    branches:
      - main
      - test
    tags:
      - v*
  # release:
  #   types: [created]

jobs:
  build:
    name: build ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - target: x86_64-pc-windows-gnu
            os: windows-2025
            cargo: cargo
            binext: .exe # binary extension
            # archive: zip
          - target: x86_64-unknown-linux-musl
            os: ubuntu-latest
            cargo: cargo
            binext: ""
            # archive: tar.gz tar.xz
          - target: aarch64-unknown-linux-musl
            os: ubuntu-latest
            cargo: cross
            binext: ""
          - target: x86_64-apple-darwin
            os: macos-latest
            cargo: cargo
            binext: ""
            # archive: zip
    steps:
      - uses: actions/checkout@v3
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          target: ${{ matrix.target }}
          override: true
          profile: minimal
      - name: Install cross
        run: |
          cargo install cross --git https://github.com/cross-rs/cross.git
        if: matrix.cargo == 'cross'
      - name: Build and strip
        shell: bash # on win, the default is ps
        run: |
          mkdir bin
          ${{ matrix.cargo }} build --features bin-build --bin zhconv --release --target ${{ matrix.target }}
          mv target/${{ matrix.target }}/release/zhconv${{ matrix.binext }} "bin/zhconv-${{ matrix.target }}${{ matrix.binext }}"
          ${{ matrix.cargo }} build --features bin-build --features opencc --bin zhconv --release --target ${{ matrix.target }}
          mv target/${{ matrix.target }}/release/zhconv${{ matrix.binext }} "bin/zhconv-opencc-${{ matrix.target }}${{ matrix.binext }}"
          strip -v "$f" || echo "strip failed"
          # if [ "${{ matrix.os }}" = "windows-2025" ]; then
          #   7z a "$staging.zip" "$staging"
          # else
          #   tar czf "$staging.tar.gz" "$staging"
          # fi
      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: binaries-${{ matrix.target }}
          path: bin/

  release:
    runs-on: ubuntu-latest
    # trigger real release only on tag push
    if: "startsWith(github.ref, 'refs/tags/')"
    needs: [build]
    steps:
      - uses: actions/download-artifact@v4
        with:
          pattern: binaries-*
          merge-multiple: true
      - name: Release
        uses: softprops/action-gh-release@v2
        with:
          files: |
            *