feat(cli): add standalone downloads and installers (#528)

* feat(cli): add standalone downloads and installers

* fix(cli): silence PowerShell download progress

* fix(cli): use framework APIs for Windows verification

* fix(cli): preserve null backup path during Windows updates

* docs(cli): translate native installation quickstart into Chinese
This commit is contained in:
Yiling-J
2026-11-12 19:37:33 +08:00
committed by GitHub
parent 0325435125
commit 97c2939b5e
20 changed files with 1339 additions and 19 deletions
+49
View File
@@ -0,0 +1,49 @@
name: Native CLI
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_call:
inputs:
source_ref:
required: true
type: string
permissions:
contents: read
jobs:
native:
name: CLI (${{ matrix.target }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- { target: linux-x64, runner: ubuntu-22.04 }
- { target: linux-arm64, runner: ubuntu-22.04-arm }
- { target: darwin-x64, runner: macos-15-intel }
- { target: darwin-arm64, runner: macos-15 }
- { target: windows-x64, runner: windows-2022 }
- { target: windows-arm64, runner: windows-11-arm }
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.source_ref || github.ref }}
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.4.4
- name: Install dependencies
run: bun install --frozen-lockfile --ignore-scripts
- name: Build CLI archive and installer
run: bun run build:cli --target ${{ matrix.target }}
- name: Test installed binary and file transfers
run: bun run test:cli-release
- uses: actions/upload-artifact@v4
with:
name: cli-${{ matrix.target }}
path: out/cli-release/shumai-cli-v*
if-no-files-found: error
retention-days: 7
+46 -16
View File
@@ -14,13 +14,30 @@ on:
description: 'Source ref to build/publish (defaults to tag)'
required: false
type: string
validate_only:
description: 'Build and test without publishing npm packages or a GitHub Release'
required: false
default: false
type: boolean
permissions: {}
concurrency:
group: npm-release-${{ github.event.inputs.tag || github.ref_name }}
cancel-in-progress: false
jobs:
cli:
uses: ./.github/workflows/cli-native.yaml
permissions:
contents: read
with:
source_ref: ${{ inputs.source_ref || inputs.tag || github.ref_name }}
release:
name: Build, Release and Publish
runs-on: ubuntu-latest
needs: cli
permissions:
contents: write
id-token: write
@@ -32,6 +49,7 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ env.SOURCE_REF }}
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v2
@@ -53,12 +71,18 @@ jobs:
- name: Install dependencies
run: bun install
- name: Validate release source and version
run: bun scripts/publish-cli-release.ts ${{ inputs.validate_only && 'validate-only' || 'validate' }}
- name: Compile i18n
run: bun run i18n:compile
- name: Lint
run: bun run lint
- name: Format
run: bun run format && git diff --exit-code
- name: Typecheck
run: bun run typecheck
@@ -68,7 +92,18 @@ jobs:
- name: Build NPM packages
run: bun run build-npm
- name: Download tested CLI archives
uses: actions/download-artifact@v4
with:
pattern: cli-*
path: out/cli-release
merge-multiple: true
- name: Assemble CLI release assets
run: bun run build:cli --assemble
- name: Generate release notes
if: ${{ !inputs.validate_only }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
@@ -87,29 +122,24 @@ jobs:
fi
} > /tmp/release-notes.md
- name: Create GitHub Release
- name: Stage draft GitHub Release and CLI assets
if: ${{ !inputs.validate_only }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ ! -s /tmp/release-notes.md ]; then
NOTES_FLAG="--generate-notes"
else
NOTES_FLAG="--notes-file /tmp/release-notes.md"
fi
if gh release view "${{ env.RELEASE_TAG }}" >/dev/null 2>&1; then
gh release edit "${{ env.RELEASE_TAG }}" \
--title "${{ env.RELEASE_TAG }}" \
$NOTES_FLAG
else
gh release create "${{ env.RELEASE_TAG }}" \
--title "${{ env.RELEASE_TAG }}" \
$NOTES_FLAG
fi
run: bun scripts/publish-cli-release.ts stage
- name: Upgrade npm for trusted publishing
if: ${{ !inputs.validate_only }}
run: |
npm install -g npm@11.16.0 --ignore-scripts
npm --version
- name: Publish to NPM
if: ${{ !inputs.validate_only }}
run: bun run scripts/publish.ts
- name: Publish completed GitHub Release
if: ${{ !inputs.validate_only }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bun scripts/publish-cli-release.ts publish