fix ci.yml #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*' | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build-and-release: | |
| name: Build and Release | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| archive: tar.gz | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| archive: tar.gz | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| archive: tar.gz | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| archive: zip | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cache cargo registry | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build binary | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Get tag name | |
| id: tag_name | |
| run: | | |
| echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Prepare binary (Unix) | |
| if: matrix.archive == 'tar.gz' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| if [ -f plm ]; then | |
| strip plm || true | |
| tar -czf ../../../plm-${{ steps.tag_name.outputs.TAG_NAME }}-${{ matrix.target }}.tar.gz plm | |
| else | |
| echo "Binary not found!" | |
| ls -la | |
| exit 1 | |
| fi | |
| - name: Prepare binary (Windows) | |
| if: matrix.archive == 'zip' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| if (Test-Path plm.exe) { | |
| Compress-Archive -Path plm.exe -DestinationPath ../../../plm-${{ steps.tag_name.outputs.TAG_NAME }}-${{ matrix.target }}.zip | |
| } else { | |
| Write-Host "Binary not found!" | |
| Get-ChildItem | |
| exit 1 | |
| } | |
| shell: powershell | |
| - name: Create Release and Upload Assets | |
| uses: softprops/action-gh-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.tag_name.outputs.TAG_NAME }} | |
| name: PLM ${{ steps.tag_name.outputs.TAG_NAME }} | |
| body: | | |
| ## PLM ${{ steps.tag_name.outputs.TAG_NAME }} | |
| ### 🚀 新功能 | |
| - 插件生命周期管理 | |
| - 配置管理系统 | |
| - CLI 工具 | |
| ### 📦 一键安装 | |
| ```bash | |
| curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/main/scripts/install.sh | sh | |
| ``` | |
| ### 📋 手动下载 | |
| 选择适合您操作系统的版本: | |
| - **Linux (x86_64)**: `plm-${{ steps.tag_name.outputs.TAG_NAME }}-x86_64-unknown-linux-gnu.tar.gz` | |
| - **macOS (Intel)**: `plm-${{ steps.tag_name.outputs.TAG_NAME }}-x86_64-apple-darwin.tar.gz` | |
| - **macOS (Apple Silicon)**: `plm-${{ steps.tag_name.outputs.TAG_NAME }}-aarch64-apple-darwin.tar.gz` | |
| - **Windows**: `plm-${{ steps.tag_name.outputs.TAG_NAME }}-x86_64-pc-windows-msvc.zip` | |
| ### 🔧 使用方法 | |
| ```bash | |
| # 初始化项目 | |
| plm init --name my-project --path . | |
| # 发现插件 | |
| plm discover | |
| # 安装插件 | |
| plm install plugin-name --version 1.0.0 | |
| # 查看帮助 | |
| plm --help | |
| ``` | |
| draft: false | |
| prerelease: false | |
| files: | | |
| plm-${{ steps.tag_name.outputs.TAG_NAME }}-${{ matrix.target }}.* | |