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 ``` **从源码**