From 3784c16aaf78e748a1a03b00a5f837c3d00f9500 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Sat, 18 Jul 2026 23:07:57 +0800 Subject: [PATCH] feat(release): publish standalone CLI archives --- .github/workflows/mcp-release.yml | 78 +++++++++++++++++++++++++++++-- docs/content/docs/cli.cn.mdx | 12 +++++ docs/content/docs/cli.mdx | 12 +++++ packages/cli/README.md | 24 ++++++++++ 4 files changed, 123 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mcp-release.yml b/.github/workflows/mcp-release.yml index b6c2aef38..37d95a619 100644 --- a/.github/workflows/mcp-release.yml +++ b/.github/workflows/mcp-release.yml @@ -729,7 +729,7 @@ jobs: VERSION: ${{ needs.prepare.outputs.version }} run: | cat > release-notes.md </dev/null 2>&1; then gh release upload "${TAG}" release-assets/* --clobber - gh release edit "${TAG}" --title "DBX MCP ${VERSION}" --notes-file release-notes.md --latest=false + gh release edit "${TAG}" --title "DBX Packages ${VERSION}" --notes-file release-notes.md --latest=false else gh release create "${TAG}" release-assets/* \ --verify-tag \ - --title "DBX MCP ${VERSION}" \ + --title "DBX Packages ${VERSION}" \ --notes-file release-notes.md \ --latest=false fi + publish-cli-github-release: + name: Publish CLI GitHub Release assets + runs-on: ubuntu-latest + needs: [prepare, publish-cli, publish-mcp-github-release] + + steps: + - uses: actions/checkout@v5 + with: + ref: ${{ needs.prepare.outputs.tag }} + + - uses: actions/setup-node@v6 + with: + node-version: 22.13.0 + registry-url: https://registry.npmjs.org + + - name: Build native CLI release archives from npm packages + shell: bash + env: + VERSION: ${{ needs.prepare.outputs.version }} + run: | + set -euo pipefail + mkdir -p release-assets + + pack_unix() { + package_name="$1" + asset_name="$2" + work_dir="$(mktemp -d)" + npm pack "${package_name}@${VERSION}" --pack-destination "${work_dir}" --json > "${work_dir}/pack.json" + tarball="${work_dir}/$(jq -r '.[0].filename' "${work_dir}/pack.json")" + tar -xzf "${tarball}" -C "${work_dir}" + mkdir -p "${work_dir}/archive" + cp "${work_dir}/package/bin/dbx" "${work_dir}/archive/dbx" + chmod +x "${work_dir}/archive/dbx" + tar -C "${work_dir}/archive" -czf "release-assets/${asset_name}.tar.gz" dbx + } + + pack_windows() { + package_name="$1" + asset_name="$2" + work_dir="$(mktemp -d)" + npm pack "${package_name}@${VERSION}" --pack-destination "${work_dir}" --json > "${work_dir}/pack.json" + tarball="${work_dir}/$(jq -r '.[0].filename' "${work_dir}/pack.json")" + tar -xzf "${tarball}" -C "${work_dir}" + zip -j "release-assets/${asset_name}.zip" "${work_dir}/package/bin/dbx.exe" + } + + pack_unix "@dbx-app/cli-darwin-arm64" "dbx-cli-darwin-arm64" + pack_unix "@dbx-app/cli-darwin-x64" "dbx-cli-darwin-x64" + pack_unix "@dbx-app/cli-linux-arm64-gnu" "dbx-cli-linux-arm64-gnu" + pack_unix "@dbx-app/cli-linux-x64-gnu" "dbx-cli-linux-x64-gnu" + pack_windows "@dbx-app/cli-win32-arm64" "dbx-cli-win32-arm64" + pack_windows "@dbx-app/cli-win32-x64" "dbx-cli-win32-x64" + + ( + cd release-assets + sha256sum *.tar.gz *.zip > CLI-SHA256SUMS + ) + + - name: Attest native CLI release archives + uses: actions/attest-build-provenance@v3 + with: + subject-path: release-assets/* + + - name: Upload CLI assets to GitHub Release + shell: bash + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ needs.prepare.outputs.tag }} + run: gh release upload "${TAG}" release-assets/* --clobber + publish-homebrew-formula: name: Publish Homebrew formula runs-on: ubuntu-latest diff --git a/docs/content/docs/cli.cn.mdx b/docs/content/docs/cli.cn.mdx index f9a3938bd..e81717028 100644 --- a/docs/content/docs/cli.cn.mdx +++ b/docs/content/docs/cli.cn.mdx @@ -20,6 +20,18 @@ brew install dbx-cli 通过 npm 安装时需要 Node.js 18.18.0 或更高版本。CLI 本身不依赖 `better-sqlite3`,也不受 Node.js native module ABI 影响。Homebrew 用户不需要单独管理 Node.js。 +### 独立原生版本 + +`packages-v*` GitHub Release 会提供适用于 macOS、Linux 和 Windows 的 CLI 原生压缩包。下载对应平台的压缩包后,使用 `CLI-SHA256SUMS` 校验,解压即可直接运行 `dbx`,不需要 Node.js。 + +```bash +tar -xzf dbx-cli-linux-x64-gnu.tar.gz +chmod +x dbx +./dbx --version +``` + +如果使用自定义或便携版 DBX 数据目录,可以设置 `DBX_DATA_DIR`。 + 查看版本: ```bash diff --git a/docs/content/docs/cli.mdx b/docs/content/docs/cli.mdx index f446225b7..49c670b38 100644 --- a/docs/content/docs/cli.mdx +++ b/docs/content/docs/cli.mdx @@ -22,6 +22,18 @@ brew install dbx-cli Node.js 18.18.0 or newer is required for the npm launcher. The CLI itself does not depend on `better-sqlite3` or a Node.js native-module ABI. Homebrew users do not need to manage Node.js separately. +### Standalone native binary + +The `packages-v*` GitHub Release provides native CLI archives for macOS, Linux, and Windows. Download the archive matching your platform, verify it with `CLI-SHA256SUMS`, extract it, and run `dbx` directly. Standalone binaries do not require Node.js. + +```bash +tar -xzf dbx-cli-linux-x64-gnu.tar.gz +chmod +x dbx +./dbx --version +``` + +Set `DBX_DATA_DIR` when using a custom or portable DBX data directory. + Check the installed version: ```bash diff --git a/packages/cli/README.md b/packages/cli/README.md index e214c7f80..3cabb5398 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -19,6 +19,30 @@ brew install dbx-cli The npm package installs the native CLI for the current platform automatically. Node.js 18.18.0 or newer is only needed for the npm launcher; direct native distributions do not require Node.js. +### Native downloads + +The `packages-v*` GitHub Release also provides standalone native CLI archives: + +| Platform | Archive | +| --- | --- | +| macOS Apple Silicon | `dbx-cli-darwin-arm64.tar.gz` | +| macOS Intel | `dbx-cli-darwin-x64.tar.gz` | +| Linux glibc ARM64 | `dbx-cli-linux-arm64-gnu.tar.gz` | +| Linux glibc x64 | `dbx-cli-linux-x64-gnu.tar.gz` | +| Windows ARM64 | `dbx-cli-win32-arm64.zip` | +| Windows x64 | `dbx-cli-win32-x64.zip` | + +Verify the downloaded archive with `CLI-SHA256SUMS`, extract it, and run the native binary directly: + +```bash +tar -xzf dbx-cli-linux-x64-gnu.tar.gz +chmod +x dbx +./dbx --version +./dbx connections list --json +``` + +Standalone binaries do not require Node.js. They read the same DBX connection storage as the desktop application; set `DBX_DATA_DIR` when using a custom or portable data directory. + ## Usage ```bash