feat: 添加 github release ci #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" # 触发条件:推送以 'v' 开头的标签 | |
| # 明确声明工作流权限 | |
| permissions: | |
| contents: write # 需要写入权限来创建 release | |
| packages: write # 可能需要包权限 | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| name: bagua-linux-x86_64 | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| name: bagua-linux-aarch64 | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| name: bagua-macos-aarch64 | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| name: bagua-windows-x86_64.exe | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Build (Linux ARM) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| cargo install cross | |
| cross build --release --target ${{ matrix.target }} | |
| - name: Build (others) | |
| if: matrix.target != 'aarch64-unknown-linux-gnu' | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Upload binaries to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: target/${{ matrix.target }}/release/${{ matrix.name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |