rust_wheel 0.1.9

A project to define some public component.
Documentation
name: rust-wheel-publish

on:
  push:
    branches: [ main ]
    # 建议只在打 tag 时发布,避免每次 push 都发布
    # tags:
    #   - 'v*'

jobs:
  publish:
    runs-on: ubuntu-latest
    name: 'publish'
    
    steps:
      - uses: actions/checkout@v4
      
      # 安装 musl 工具链(如果需要)
      - name: Install musl tools
        run: |
          sudo apt-get update
          sudo apt-get install -y musl-tools musl-dev
      
      # 设置 Rust 工具链
      - name: Setup Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          components: rustfmt, clippy
          targets: x86_64-unknown-linux-musl  # 如果需要 musl
      
      # 使用缓存加速构建
      - 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-
      
      # 登录 crates.io
      - name: Login to crates.io
        run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
      
      # 直接使用 cargo publish 而不是 publish-action
      - name: Publish to crates.io
        run: cargo publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}