wx-cli 0.1.0

WeChat 4.x (macOS/Linux) local data CLI — decrypt SQLCipher DBs, query chat history, watch new messages
name: Release

on:
  push:
    tags: ['v*']
  workflow_dispatch:

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: macos-latest
            target: aarch64-apple-darwin
            name: wx-macos-arm64
          - os: macos-latest
            target: x86_64-apple-darwin
            name: wx-macos-x86_64
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            name: wx-linux-x86_64
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            name: wx-windows-x86_64.exe

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

    steps:
      - uses: actions/checkout@v4

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

      - name: Cache cargo registry
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: ${{ runner.os }}-cargo-

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

      - name: Rename binary (Unix)
        if: matrix.os != 'windows-latest'
        run: |
          cp target/${{ matrix.target }}/release/wx ${{ matrix.name }}

      - name: Rename binary (Windows)
        if: matrix.os == 'windows-latest'
        run: |
          copy target\${{ matrix.target }}\release\wx.exe ${{ matrix.name }}

      - uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.name }}
          path: ${{ matrix.name }}

      - name: Upload to GitHub Release
        uses: softprops/action-gh-release@v2
        if: startsWith(github.ref, 'refs/tags/')
        with:
          files: ${{ matrix.name }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}