From 409005cd7500effea95278890f02c192aff006db Mon Sep 17 00:00:00 2001 From: juice094 <160722440+juice094@users.noreply.github.com> Date: Thu, 14 May 2026 21:22:00 +0800 Subject: [PATCH] =?UTF-8?q?ci(release):=20=E6=B7=BB=E5=8A=A0=20Linux=20?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=20job=20+=20=E6=9B=B4=E6=96=B0=20README=20?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E9=93=BE=E6=8E=A5=E5=8C=B9=E9=85=8D=20v0.20.?= =?UTF-8?q?0=20=E8=B5=84=E4=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 40 +++++++++++++++++++++++++++++++++-- README.md | 14 +++++++----- 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f9b3115..152153b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,11 +47,47 @@ jobs: Copy-Item "CHANGELOG.md" "$outDir\" Compress-Archive -Path $outDir -DestinationPath "$outDir.zip" -Force Write-Host "Created $outDir.zip" - - name: Upload to GitHub Release + - name: Upload Windows asset shell: powershell env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | $version = "${{ github.ref_name }}" $archive = "devbase-$version-windows-x64.zip" - gh release create $version $archive --generate-notes --repo ${{ github.repository }} + gh release upload $version $archive --repo ${{ github.repository }} --clobber + + build-linux: + name: Build Linux Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + key: release-linux + - name: Build release binary + run: cargo build --release --locked + - name: Run tests + run: cargo test --workspace -- --test-threads=4 + - name: Verify clippy clean + run: cargo clippy --all-targets -- -D warnings + - name: Verify fmt clean + run: cargo fmt --check + - name: Package binary + run: | + version="${{ github.ref_name }}" + outDir="devbase-${version}-linux-x64" + mkdir -p "$outDir" + cp target/release/devbase "$outDir/" + cp README.md "$outDir/" + cp LICENSE "$outDir/" + cp CHANGELOG.md "$outDir/" + tar czf "${outDir}.tar.gz" "$outDir" + echo "Created ${outDir}.tar.gz" + - name: Upload Linux asset + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + version="${{ github.ref_name }}" + archive="devbase-${version}-linux-x64.tar.gz" + gh release upload "$version" "$archive" --repo ${{ github.repository }} --clobber diff --git a/README.md b/README.md index 57f04b0..0a0ceb2 100644 --- a/README.md +++ b/README.md @@ -70,18 +70,22 @@ curl -fsSL https://raw.githubusercontent.com/juice094/devbase/main/scripts/insta | 平台 | 下载 | 大小 | |:---|:---|:---| -| Windows x86_64 | [`devbase-v0.20.0-x86_64-pc-windows-msvc.exe`](https://github.com/juice094/devbase/releases/download/v0.20.0/devbase-v0.20.0-x86_64-pc-windows-msvc.exe) | ~30 MB | -| Linux x86_64 | [`devbase-v0.20.0-x86_64-unknown-linux-gnu`](https://github.com/juice094/devbase/releases/download/v0.20.0/devbase-v0.20.0-x86_64-unknown-linux-gnu) | ~28 MB | +| Windows x86_64 | [`devbase-v0.20.0-windows-x64.zip`](https://github.com/juice094/devbase/releases/download/v0.20.0/devbase-v0.20.0-windows-x64.zip) | ~8.7 MB | +| Linux x86_64 | [`devbase-v0.20.0-linux-x64.tar.gz`](https://github.com/juice094/devbase/releases/download/v0.20.0/devbase-v0.20.0-linux-x64.tar.gz) | ~8.8 MB | ```powershell # Windows (PowerShell) -Invoke-WebRequest -Uri "https://github.com/juice094/devbase/releases/download/v0.20.0/devbase-v0.20.0-x86_64-pc-windows-msvc.exe" -OutFile devbase.exe +Invoke-WebRequest -Uri "https://github.com/juice094/devbase/releases/download/v0.20.0/devbase-v0.20.0-windows-x64.zip" -OutFile devbase.zip +Expand-Archive -Path devbase.zip -DestinationPath . -Force +# 提取后的 devbase.exe 可直接运行 ``` ```bash # Linux -wget https://github.com/juice094/devbase/releases/download/v0.20.0/devbase-v0.20.0-x86_64-unknown-linux-gnu -O devbase -chmod +x devbase +curl -fsSL -o devbase.tar.gz https://github.com/juice094/devbase/releases/download/v0.20.0/devbase-v0.20.0-linux-x64.tar.gz +tar xzf devbase.tar.gz +cp devbase-v0.20.0-linux-x64/devbase /usr/local/bin/ # 或任意 PATH 目录 +chmod +x /usr/local/bin/devbase ``` **从源码**