DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
fix(ci): follow desktop releases with Android and unsigned iOS builds (#1038)
Mao Mr292a85554da3
diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.ymlindex 302a181a..f30c9ea5 100644--- a/.github/workflows/build-android.yml+++ b/.github/workflows/build-android.yml@@ -1,33 +1,27 @@name: Android Native Build-# 常规构建产物:main 上的 native 变更与手动触发时产出正式签名的 APK。-# 只上传 Actions artifact,不碰任何 GitHub Release(随桌面端 release 发布见 release-native.yml,-# PR 校验构建见 build-android-test.yml)。-#-# 签名 secret(与 dsh-bridge-mobile 同名,需在本仓库 Settings → Secrets 配置):-# ANDROID_KEYSTORE_BASE64 keystore 的 Base64-# ANDROID_KEYSTORE_PASSWORD keystore 密码-# ANDROID_KEY_ALIAS 签名 key alias-# ANDROID_KEY_PASSWORD 签名 key 密码-# 四项全有 → 用正式 key 重新签名;四项全无 → 用 Android 开发证书并在日志/摘要中警告;-# 部分配置 → 直接失败(半成品签名不可发布)。on:- push:- branches: [main]- paths:- - src-native/**- - assets/native/**- - app.json- - app.config.js- - metro.config.js- - tsconfig.native.json- - vitest.native.config.ts- - package.json- - pnpm-lock.yaml- - pnpm-workspace.yaml- - .github/workflows/build-android.ymlworkflow_dispatch:workflow_call:+ inputs:+ source_ref:+ required: false+ type: string+ default: ''+ secrets:+ ANDROID_KEYSTORE_BASE64:+ required: false+ ANDROID_KEYSTORE_PASSWORD:+ required: false+ ANDROID_KEY_ALIAS:+ required: false+ ANDROID_KEY_PASSWORD:+ required: false+ outputs:+ version:+ value: ${{ jobs.build.outputs.version }}+ signing:+ value: ${{ jobs.build.outputs.signing }}permissions:contents: read@@ -48,6 +42,7 @@ jobs:- name: Checkout repositoryuses: actions/checkout@v7with:+ ref: ${{ inputs.source_ref || github.sha }}persist-credentials: false- name: Setup Node.js and pnpm@@ -55,9 +50,6 @@ jobs:- name: Install dependenciesrun: pnpm install --frozen-lockfile-- # 资产名里的版本号取自 app.json 的 expo.version;bumpp 目前只改 package.json /- # Cargo.toml / tauri.conf.json,两者不一致时必须在发版前同步。- name: Read native versionid: metarun: |@@ -126,9 +118,6 @@ jobs:run: |chmod +x gradlew./gradlew :app:assembleRelease --no-daemon --stacktrace-- # 发布资产名固定为 Deepseek.Harness.Android_<expo.version>.apk;同时校验 16 KB- # 页对齐、签名、APK 内的标准版本号,以及 app.config.js 注入的第三方声明。- name: Sign and verify APKenv:VERSION: ${{ steps.meta.outputs.version }}@@ -159,7 +148,6 @@ jobs:cp "$source" "$destination"fi"$tools/apksigner" verify --verbose --print-certs "$destination"- # 先落文件再读取:`aapt dump badging | head` 会让 aapt 收到 SIGPIPE,pipefail 下误报失败。"$tools/aapt" dump badging "$destination" > "$RUNNER_TEMP/badging.txt"head -n 5 "$RUNNER_TEMP/badging.txt"grep -q "versionName='${VERSION}'" "$RUNNER_TEMP/badging.txt" \@@ -183,7 +171,7 @@ jobs:console.log("APK embeds the complete third-party notices.");'cp THIRD_PARTY_NOTICES.md release/THIRD_PARTY_NOTICES.md- (cd release && sha256sum ./*.apk ./THIRD_PARTY_NOTICES.md > SHA256SUMS.txt)+ (cd release && sha256sum ./*.apk ./THIRD_PARTY_NOTICES.md > SHA256SUMS-Android.txt)find release -type f -print | sort- name: Upload APK artifactdiff --git a/.github/workflows/build-bundle-macos.yml b/.github/workflows/build-bundle-macos.ymlindex 91edc7fb..14464e00 100644--- a/.github/workflows/build-bundle-macos.yml+++ b/.github/workflows/build-bundle-macos.yml@@ -70,7 +70,7 @@ jobs:- name: Setup Xcodeif: steps.check.outputs.should_run == 'true'- uses: $/.github/actions/setup-xcode+ uses: ./.github/actions/setup-xcode- name: Setup Node.js and pnpmif: steps.check.outputs.should_run == 'true'diff --git a/.github/workflows/build-ios-test.yml b/.github/workflows/build-ios-test.ymlnew file mode 100644index 00000000..7fe55ff2--- /dev/null+++ b/.github/workflows/build-ios-test.yml@@ -0,0 +1,23 @@+name: Build iOS Test++on:+ workflow_dispatch:+ inputs:+ source_ref:+ description: Commit, tag or branch to build; empty uses the dispatch ref+ required: false+ type: string+ default: ''++permissions:+ contents: read++concurrency:+ group: build-ios-test-${{ github.ref }}+ cancel-in-progress: true++jobs:+ build-test-ipa:+ uses: ./.github/workflows/build-ios.yml+ with:+ source_ref: ${{ inputs.source_ref }}diff --git a/.github/workflows/build-ios.yml b/.github/workflows/build-ios.ymlnew file mode 100644index 00000000..b6d5c033--- /dev/null+++ b/.github/workflows/build-ios.yml@@ -0,0 +1,164 @@+name: iOS Native Build++on:+ workflow_call:+ inputs:+ source_ref:+ description: Commit, tag or branch to build; empty uses the caller ref+ required: false+ type: string+ default: ''+ outputs:+ version:+ description: Full package version used in the artifact name+ value: ${{ jobs.build.outputs.version }}++permissions:+ contents: read++jobs:+ build:+ name: Build unsigned iOS IPA+ runs-on: macos-latest+ timeout-minutes: 90+ outputs:+ version: ${{ steps.meta.outputs.version }}+ defaults:+ run:+ shell: bash+ env:+ CI: '1'+ steps:+ - name: Checkout repository+ uses: actions/checkout@v7+ with:+ ref: ${{ inputs.source_ref }}+ persist-credentials: false++ - name: Setup Xcode+ uses: ./.github/actions/setup-xcode++ - name: Setup Node.js and pnpm+ uses: ./.github/actions/setup-node-pnpm++ - name: Install dependencies+ run: pnpm install --frozen-lockfile++ - name: Read version and normalize iOS marketing version+ id: meta+ run: |+ set -euo pipefail+ node --input-type=commonjs <<'NODE'+ const fs = require('node:fs');+ const semver = require('semver');+ const app = JSON.parse(fs.readFileSync('app.json', 'utf8'));+ const version = JSON.parse(fs.readFileSync('package.json', 'utf8')).version;+ if (app.expo.version !== version) throw new Error('app.json expo.version must equal package.json version');+ const parsed = semver.parse(version);+ if (!parsed || `${parsed.version}${parsed.build.length ? '+' + parsed.build.join('.') : ''}` !== version) throw new Error('package version must be canonical SemVer');+ const iosVersion = `${parsed.major}.${parsed.minor}.${parsed.patch}`;+ const identifier = app.expo.ios?.bundleIdentifier;+ const buildNumber = app.expo.ios?.buildNumber;+ if (typeof identifier !== 'string' || identifier !== identifier.trim() || !/^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/.test(identifier)) throw new Error('Invalid iOS bundle identifier');+ if (typeof buildNumber !== 'string' || buildNumber !== buildNumber.trim() || !/^\d+(?:\.\d+){0,2}$/.test(buildNumber)) throw new Error('Invalid iOS build number');+ fs.appendFileSync(process.env.GITHUB_OUTPUT, `version=${version}\nios_version=${iosVersion}\nidentifier=${identifier}\nbuild_number=${buildNumber}\n`);+ app.expo.version = iosVersion;+ fs.writeFileSync('app.json', `${JSON.stringify(app, null, 2)}\n`);+ NODE++ - name: Generate iOS project+ run: pnpm exec expo prebuild --platform ios --no-install++ - name: Install CocoaPods dependencies+ working-directory: ios+ run: pod install++ - name: Build unsigned device Release app+ run: |+ set -euo pipefail+ workspaces=(ios/*.xcworkspace)+ if [[ ${#workspaces[@]} -ne 1 || ! -d "${workspaces[0]}" ]]; then+ echo '::error::Expected one generated iOS workspace'+ exit 1+ fi+ scheme="$(basename "${workspaces[0]}" .xcworkspace)"+ xcodebuild \+ -workspace "${workspaces[0]}" \+ -scheme "$scheme" \+ -configuration Release \+ -sdk iphoneos \+ -destination 'generic/platform=iOS' \+ -derivedDataPath "$RUNNER_TEMP/ios-derived-data" \+ CODE_SIGNING_ALLOWED=NO \+ CODE_SIGNING_REQUIRED=NO \+ CODE_SIGN_IDENTITY='' \+ build++ - name: Package and verify unsigned IPA+ env:+ VERSION: ${{ steps.meta.outputs.version }}+ IOS_VERSION: ${{ steps.meta.outputs.ios_version }}+ BUNDLE_IDENTIFIER: ${{ steps.meta.outputs.identifier }}+ BUILD_NUMBER: ${{ steps.meta.outputs.build_number }}+ run: |+ set -euo pipefail+ apps=("$RUNNER_TEMP/ios-derived-data/Build/Products/Release-iphoneos/"*.app)+ if [[ ${#apps[@]} -ne 1 || ! -d "${apps[0]}" ]]; then+ echo '::error::Expected one Release device app'+ exit 1+ fi+ mkdir -p "$RUNNER_TEMP/ios-ipa/Payload" release+ ditto "${apps[0]}" "$RUNNER_TEMP/ios-ipa/Payload/$(basename "${apps[0]}")"+ export IPA_PATH="$PWD/release/Deepseek.Harness.iOS_${VERSION}_unsigned.ipa"+ (cd "$RUNNER_TEMP/ios-ipa" && zip -qr "$IPA_PATH" Payload)+ python3 <<'PY'+ import json+ import os+ import plistlib+ import zipfile+ from pathlib import Path++ with zipfile.ZipFile(os.environ['IPA_PATH']) as ipa:+ assert ipa.testzip() is None, 'Corrupt IPA archive'+ infos = [name for name in ipa.namelist() if name.startswith('Payload/') and name.endswith('.app/Info.plist') and name.count('/') == 2]+ assert len(infos) == 1, 'IPA must contain exactly one app'+ root = infos[0].removesuffix('Info.plist')+ info = plistlib.loads(ipa.read(infos[0]))+ assert info['CFBundleIdentifier'] == os.environ['BUNDLE_IDENTIFIER'], 'Incorrect iOS bundle identifier'+ assert info['CFBundleShortVersionString'] == os.environ['IOS_VERSION'], 'Incorrect iOS marketing version'+ assert info['CFBundleVersion'] == os.environ['BUILD_NUMBER'], 'Incorrect iOS build number'+ assert info['CFBundleSupportedPlatforms'] == ['iPhoneOS'], 'IPA must target physical iOS devices'+ assert ipa.getinfo(root + info['CFBundleExecutable']).file_size > 0, 'Missing native executable'+ assert ipa.getinfo(root + 'main.jsbundle').file_size > 0, 'IPA must embed a non-empty JavaScript bundle'+ config = json.loads(ipa.read(root + 'EXConstants.bundle/app.config'))+ assert config['version'] == os.environ['IOS_VERSION'], 'Embedded Expo version mismatch'+ assert config['ios']['bundleIdentifier'] == os.environ['BUNDLE_IDENTIFIER'], 'Embedded Expo identifier mismatch'+ assert config['extra']['thirdPartyNotices'] == Path('THIRD_PARTY_NOTICES.md').read_text(encoding='utf-8'), 'IPA is missing the complete third-party notices'+ print('Verified device IPA identifier, versions, executable, JavaScript bundle and third-party notices.')+ PY+ cp THIRD_PARTY_NOTICES.md release/THIRD_PARTY_NOTICES.md+ (cd release && shasum -a 256 ./*.ipa ./THIRD_PARTY_NOTICES.md > SHA256SUMS-iOS.txt)++ - name: Upload IPA artifact+ uses: actions/upload-artifact@v6+ with:+ name: ios-ipa-${{ steps.meta.outputs.version }}+ path: release/+ if-no-files-found: error+ retention-days: 14++ - name: Summarize unsigned build+ env:+ VERSION: ${{ steps.meta.outputs.version }}+ IOS_VERSION: ${{ steps.meta.outputs.ios_version }}+ run: |+ echo '::notice::IPA 未签名,无 provisioning profile;真机安装前必须自行签名,不能直接安装或提交 App Store。'+ {+ echo '### iOS native build'+ echo+ echo "- asset: \`Deepseek.Harness.iOS_${VERSION}_unsigned.ipa\`"+ echo "- iOS marketing version: \`${IOS_VERSION}\`"+ echo '- signing: unsigned; no signing secrets used'+ echo+ echo '> 未签名 IPA 必须自行签名后才能安装到真机,不能直接安装或提交 App Store。'+ } >> "$GITHUB_STEP_SUMMARY"diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.ymlindex 2cec8a4b..b0329da2 100644--- a/.github/workflows/build-macos.yml+++ b/.github/workflows/build-macos.yml@@ -70,7 +70,7 @@ jobs:- name: Setup Xcodeif: steps.check.outputs.should_run == 'true'- uses: $/.github/actions/setup-xcode+ uses: ./.github/actions/setup-xcode- name: Setup Node.js and pnpmif: steps.check.outputs.should_run == 'true'diff --git a/.github/workflows/release-native.yml b/.github/workflows/release-native.ymlindex 8db32c9c..36f302eb 100644--- a/.github/workflows/release-native.yml+++ b/.github/workflows/release-native.yml@@ -1,20 +1,4 @@-name: Release Android APK (Native)--# 桌面端发布完成后,用**同一个 release 提交**构建 Android APK,并把资产-# `Deepseek.Harness.Android_<expo.version>.apk` 上传到该 release。iOS 不发布。-#-# 触发方式与 release-bundle.yml 保持一致:release.yml 只由 tag push / release/* PR 合并 /-# 手动触发启动,没有任何分支触发路径,因此 workflow_run 不设 branches 过滤(设了反而会-# 漏掉 tag push 与 PR 合并两条正式发布路径),只保留 types: [completed],conclusion 与-# 「触发运行来自本仓库」两条判断放在 job 级。-#-# 签名 secret(与 dsh-bridge-mobile 同名,需在本仓库 Settings → Secrets 配置):-# ANDROID_KEYSTORE_BASE64 keystore 的 Base64-# ANDROID_KEYSTORE_PASSWORD keystore 密码-# ANDROID_KEY_ALIAS 签名 key alias-# ANDROID_KEY_PASSWORD 签名 key 密码-# 四项全有 → 正式 key 签名;四项全无 → 开发证书 + 警告(不改变 release 的 draft/prerelease-# 状态,那是 release.yml finalize 的职责);部分配置 → 直接失败。+name: Release Mobile Apps (Native)on:workflow_run:workflows: ['Build & Release']@@ -35,14 +19,15 @@ concurrency:jobs:prepare:- name: Prepare Android Release- # workflow_run 会为 release.yml 的每一次结束触发(含失败/取消/整轮所有 job 被跳过);- # 被跳过的 job 报告 success,所以还必须要求触发运行来自本仓库。+ name: Prepare Mobile Releaseif: >-github.event_name == 'workflow_dispatch' ||(github.event.workflow_run.conclusion == 'success' &&github.event.workflow_run.head_repository.full_name == github.repository)runs-on: ubuntu-latest+ permissions:+ contents: read+ actions: readoutputs:should_build: ${{ steps.release.outputs.should_build }}tag: ${{ steps.release.outputs.tag }}@@ -51,7 +36,6 @@ jobs:- name: Checkout triggering commituses: actions/checkout@v7with:- # 只用它推导 tag:真正的构建源是按 tag 推导出的发布提交(见下一步)。ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}fetch-depth: 0persist-credentials: false@@ -64,10 +48,10 @@ jobs:EVENT_NAME: ${{ github.event_name }}TRIGGER_EVENT: ${{ github.event.workflow_run.event }}RUN_HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}+ RUN_ID: ${{ github.event.workflow_run.id }}TAG_INPUT: ${{ inputs.tag }}run: |set -euo pipefail- # 桌面端 release 的 tag 恒为 v<package.json version>(scripts/release-identity.mjs)。pkg_version="$(node --input-type=commonjs -p "require('./package.json').version")"manual=falseif [ "$EVENT_NAME" = "workflow_dispatch" ]; then@@ -85,18 +69,20 @@ jobs:echo "::warning::$1"exit 0}- # 手动指定了 tag 说明用户有明确目标,静默跳过会让人以为构建成功。fail() {if [ "$manual" = true ]; thenecho "::error::$1"exit 1fi- skip "$1; skipping the Android APK build"+ skip "$1; skipping the mobile build"}-- # release.yml 的手动触发是试跑:它发的是 test-<ref>-<run> 预发布,tag 不指向本次构建的提交。- if [ "$TRIGGER_EVENT" = "workflow_dispatch" ]; then- fail "the triggering Build & Release run is a manual test release, whose tag does not point at the commit it built"+ if [ "$EVENT_NAME" = 'workflow_run' ]; then+ case "$TRIGGER_EVENT" in+ push|pull_request) ;;+ *) skip 'the triggering run is not a desktop version release' ;;+ esac+ published="$(gh run view "$RUN_ID" --json jobs --jq '.jobs[] | select(.name == "Publish GitHub Release") | .conclusion')"+ [ "$published" = 'success' ] || skip 'the desktop release was not published'fiif [ -z "$tag" ] && [[ "$RUN_HEAD_BRANCH" == v* ]]; then@@ -108,9 +94,6 @@ jobs:gh release view "$tag" >/dev/null 2>&1 \|| fail "release $tag does not exist"-- # 构建源必须是 tag 指向的提交:合并 release/* PR 时 tag 建在 merge commit 上,- # 而 workflow_run 的 head_sha 只是 PR 分支的 head,两者不是同一个提交。tag_commit="$(git rev-parse --verify --quiet "${tag}^{commit}" || true)"if [ -z "$tag_commit" ]; thenfail "cannot resolve tag $tag locally"@@ -118,191 +101,62 @@ jobs:if [ "$manual" = true ] && [ "$(git rev-parse HEAD)" != "$tag_commit" ]; thenfail "tag $tag points at $tag_commit but this run is dispatched from $(git rev-parse HEAD); dispatch this workflow from the $tag ref"fi- # 迁移 native 之前的 tag 没有 app.json / expo 配置,构建它只会产出错误的版本号。if ! git cat-file -e "${tag_commit}:app.json" 2>/dev/null; thenfail "tag $tag points at $tag_commit, which predates the native Android pipeline"fi- echo "android release target: $tag from $tag_commit"+ echo "mobile release target: $tag from $tag_commit"emit true "$tag_commit"build:name: Build Android APKneeds: prepare- if: >-- needs.prepare.result == 'success' &&- needs.prepare.outputs.should_build == 'true'- runs-on: ubuntu-latest- timeout-minutes: 60- outputs:- version: ${{ steps.meta.outputs.version }}- signing: ${{ steps.signing.outputs.mode }}- steps:- - name: Checkout release commit- uses: actions/checkout@v7- with:- ref: ${{ needs.prepare.outputs.source_ref }}- fetch-depth: 0- persist-credentials: false-- - name: Setup Node.js and pnpm- uses: ./.github/actions/setup-node-pnpm-- - name: Install dependencies- run: pnpm install --frozen-lockfile-- # 资产名里的版本号取自 release 提交的 app.json expo.version;桌面端 tag 由- # package.json 决定,两者不一致就会发出与 release 版本不符的资产,必须失败。- - name: Read native version- id: meta- run: |- set -euo pipefail- version="$(node --input-type=commonjs -p "require('./app.json').expo.version")"- pkg="$(node --input-type=commonjs -p "require('./package.json').version")"- if [ "$version" != "$pkg" ]; then- echo "::error::app.json expo.version ($version) != package.json version ($pkg); 请让 native 版本跟随桌面端版本(bump 流程需同步 app.json)"- exit 1- fi- echo "version=$version" >> "$GITHUB_OUTPUT"- echo "native version: $version"-- - name: Typecheck native sources- run: pnpm run typecheck:native-- - name: Test native sources- run: pnpm run test:native-- - name: Determine signing mode- id: signing- env:- KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}- KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}- KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}- KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}- run: |- set -euo pipefail- present=0- for value in "$KEYSTORE_BASE64" "$KEYSTORE_PASSWORD" "$KEY_ALIAS" "$KEY_PASSWORD"; do- if [[ -n "$value" ]]; then present=$((present + 1)); fi- done- if [[ "$present" -eq 0 ]]; then- echo 'mode=debug' >> "$GITHUB_OUTPUT"- echo '::warning::ANDROID_KEYSTORE_BASE64 / ANDROID_KEYSTORE_PASSWORD / ANDROID_KEY_ALIAS / ANDROID_KEY_PASSWORD 均未配置,发布资产将使用 Android 开发证书。'- elif [[ "$present" -eq 4 ]]; then- echo 'mode=release' >> "$GITHUB_OUTPUT"- else- echo '::error::Android 签名 secret 必须四项全配或全不配;当前配置不完整。'- exit 1- fi-- - name: Setup JDK 17- uses: actions/setup-java@v6- with:- distribution: temurin- java-version: '17'-- - name: Setup Android SDK- uses: android-actions/setup-android@v4- with:- cmdline-tools-version: '12266719'-- - name: Install Android build tools- run: sdkmanager 'platforms;android-36' 'build-tools;36.0.0' 'ndk;27.1.12297006' 'cmake;3.22.1'-- - name: Generate Android project- env:- CI: '1'- run: pnpm run prebuild:native-- - name: Build release APK- env:- CI: '1'- working-directory: android- run: |- chmod +x gradlew- ./gradlew :app:assembleRelease --no-daemon --stacktrace-- # 发布资产名固定为 Deepseek.Harness.Android_<expo.version>.apk;同时校验 16 KB- # 页对齐、签名、APK 内的标准版本号,以及 app.config.js 注入的第三方声明。- - name: Sign and verify APK- env:- VERSION: ${{ steps.meta.outputs.version }}- SIGNING_MODE: ${{ steps.signing.outputs.mode }}- KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}- KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}- KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}- KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}- run: |- set -euo pipefail- tools="$ANDROID_HOME/build-tools/36.0.0"- source='android/app/build/outputs/apk/release/app-release.apk'- mkdir -p release- destination="release/Deepseek.Harness.Android_${VERSION}.apk"- "$tools/zipalign" -c -P 16 4 "$source"- if [[ "$SIGNING_MODE" == 'release' ]]; then- keystore="$RUNNER_TEMP/dsh-bridge-release.keystore"- trap 'rm -f -- "$keystore"' EXIT- umask 077- printf '%s' "$KEYSTORE_BASE64" | base64 --decode > "$keystore"- "$tools/apksigner" sign \- --ks "$keystore" \- --ks-key-alias "$KEY_ALIAS" \- --ks-pass env:KEYSTORE_PASSWORD \- --key-pass env:KEY_PASSWORD \- --out "$destination" "$source"- else- cp "$source" "$destination"- fi- "$tools/apksigner" verify --verbose --print-certs "$destination"- # 先落文件再读取:`aapt dump badging | head` 会让 aapt 收到 SIGPIPE,pipefail 下误报失败。- "$tools/aapt" dump badging "$destination" > "$RUNNER_TEMP/badging.txt"- head -n 5 "$RUNNER_TEMP/badging.txt"- grep -q "versionName='${VERSION}'" "$RUNNER_TEMP/badging.txt" \- || { echo "::error::APK versionName 与 app.json expo.version ${VERSION} 不一致"; exit 1; }- APK_PATH="$destination" node --input-type=commonjs -e '- const fs = require("node:fs");- const { execFileSync } = require("node:child_process");- const apk = process.env.APK_PATH;- const config = JSON.parse(execFileSync("unzip", ["-p", apk, "assets/app.config"], { encoding: "utf8" }));- const notice = fs.readFileSync("THIRD_PARTY_NOTICES.md", "utf8");- if (config.extra?.thirdPartyNotices !== notice) throw new Error("APK is missing the complete third-party notices");- console.log("APK embeds the complete third-party notices.");- '- cp THIRD_PARTY_NOTICES.md release/THIRD_PARTY_NOTICES.md- (cd release && sha256sum ./*.apk ./THIRD_PARTY_NOTICES.md > SHA256SUMS.txt)- find release -type f -print | sort-- - name: Upload APK artifact- uses: actions/upload-artifact@v6- with:- name: android-apk-release- path: release/- if-no-files-found: error- retention-days: 14+ if: needs.prepare.outputs.should_build == 'true'+ uses: ./.github/workflows/build-android.yml+ with:+ source_ref: ${{ needs.prepare.outputs.source_ref }}+ secrets:+ ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}+ ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}+ ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}+ ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}++ build-ios:+ name: Build unsigned iOS IPA+ needs: prepare+ if: needs.prepare.outputs.should_build == 'true'+ uses: ./.github/workflows/build-ios.yml+ with:+ source_ref: ${{ needs.prepare.outputs.source_ref }}publish:- name: Publish APK Asset- needs: [prepare, build]+ name: Publish Mobile Assets+ needs: [prepare, build, build-ios]if: >-needs.prepare.result == 'success' &&needs.build.result == 'success' &&+ needs.build-ios.result == 'success' &&needs.prepare.outputs.should_build == 'true'runs-on: ubuntu-latesttimeout-minutes: 15- # 写权限只给真正上传资产的这一步。permissions:contents: writesteps:- name: Download APK artifactuses: actions/download-artifact@v7with:- name: android-apk-release+ name: android-apk-${{ needs.build.outputs.version }}+ path: release++ - name: Download IPA artifact+ uses: actions/download-artifact@v7+ with:+ name: ios-ipa-${{ needs.build-ios.outputs.version }}path: release- name: Upload assets to releaseenv:GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}- # publish 未 checkout,gh 无法从 .git 推断仓库,需显式指定。GH_REPO: ${{ github.repository }}RELEASE_TAG: ${{ needs.prepare.outputs.tag }}VERSION: ${{ needs.build.outputs.version }}@@ -311,14 +165,15 @@ jobs:set -euo pipefailapk="release/Deepseek.Harness.Android_${VERSION}.apk"[ -f "$apk" ] || { echo "::error::$apk was not downloaded"; exit 1; }- # 只上传,不新建/不改写 release:release.yml 的 finalize 是 Release 的单一 writer。- gh release upload "$RELEASE_TAG" "$apk" release/SHA256SUMS.txt release/THIRD_PARTY_NOTICES.md --clobber+ ipa="release/Deepseek.Harness.iOS_${VERSION}_unsigned.ipa"+ [ -f "$ipa" ] || { echo "::error::$ipa was not downloaded"; exit 1; }+ gh release upload "$RELEASE_TAG" "$apk" "$ipa" release/SHA256SUMS-Android.txt release/SHA256SUMS-iOS.txt release/THIRD_PARTY_NOTICES.md --clobber{- echo "### Android APK asset"+ echo "### Mobile release assets"echoecho "- asset: \`Deepseek.Harness.Android_${VERSION}.apk\`"echo "- signing: \`${SIGNING_MODE}\`"- echo "- iOS: 未发布"+ echo "- iOS: unsigned IPA; requires signing before installation"} >> "$GITHUB_STEP_SUMMARY"if [[ "$SIGNING_MODE" == 'debug' ]]; thenecho '> [!WARNING]' >> "$GITHUB_STEP_SUMMARY"diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 75573147..1baec3bf 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -115,6 +115,8 @@ jobs:- **macOS (Intel)**: 下载 `x64.dmg`- **Windows**: 下载 `.exe`- **Linux (x64)**: 下载 `.AppImage` 或 `.deb`(基于 Ubuntu 22.04 构建)+ - **Android**: 桌面端发布后追加 `.apk`;未配置签名密钥时使用开发证书,仅供评估+ - **iOS**: 桌面端发布后追加 `_unsigned.ipa`;需自行签名,不能直接安装> 文件名带 `_Bundle` 后缀的是**离线捆绑包**:安装包里已内置 Node.js 运行时、pnpm> 与打包好的 dsh 内核,首次启动无需联网即可直接运行。不带该后缀的是常规安装包,diff --git a/README.en.md b/README.en.mdindex 2bd177b4..5137c11d 100644--- a/README.en.md+++ b/README.en.md@@ -46,6 +46,7 @@## Features- 🪶 **Native desktop** — Tauri 2 + React 19 + HeroUI 3, embedding the local Harness UI.+- 📱 **Remote connection** — Connect to the DSH instance on your computer from the native Android / iOS mobile app.- 🔄 **Runtime management** — Install dependencies, select core versions, and access desktop/core updates.- 🔀 **Multi-backend support** — Use DSH / Codex / Claude in one interface, powered by their native tools.- 🧩 **Plugin management** — 13 built-in plugins, plus local-directory installs, built-in disabling, community plugin installation, upgrades, removal, and error details.@@ -81,7 +82,6 @@ Setup offers the following community plugins for installation on demand.- [DSH Better Sidebar](https://github.com/omdsh-dev/DSH-better-sidebar) — Per-session editor sidebar- [Billion Context](https://github.com/ranxianglei/billion-context) — Context compression and history restoration- [DSH Rewind](https://github.com/SiriLee/dsh-rewind) — Conversation rewind and workspace backups-- [DSH Bridge](https://github.com/wenbin-wb/dsh-bridge) — Remote access, tunnels, and bot connections- [DSH IM](https://github.com/xmanrui/dsh-im) — IM channels and bot managementRequest new or updated presets via [Issues](https://github.com/dsh-tauri/deepseek-harness-desktop/issues). Available versions follow the manifest's core compatibility rules.@@ -119,7 +119,7 @@ brew install dsh-tauri/desktop/deepseek-harnessThe same repository also maintains the **DSH Mobile** mobile app (Expo / React Native): it discovers a DSH host on the local network and hosts the Harness web UI in a full-screen WebView. The source lives in `src-native/`.- Android APKs are downloadable from the [Releases](https://github.com/dsh-tauri/deepseek-harness-desktop/releases) page as `Deepseek.Harness.Android_x.x.x.apk`, and the version follows the desktop app.-- **iOS is not published yet**: only the Android build and release pipeline exists.+- **An unsigned iOS IPA is distributed with desktop releases**; you must sign it yourself before installation—it cannot be installed directly.- The mobile app is maintained **only while no official mobile service exists**, as a stopgap.- Development commands (`pnpm dev:native`, `pnpm android`, `pnpm test:native`, `pnpm typecheck:native`, …) plus the discovery, connection, persistence and release conventions are documented in the [mobile specification](docs/specs/native.md).diff --git a/README.es.md b/README.es.mdindex 9949839b..651201f5 100644--- a/README.es.md+++ b/README.es.md@@ -46,6 +46,7 @@## Características- 🪶 **Escritorio nativo** — Tauri 2 + React 19 + HeroUI 3, con la interfaz local de Harness integrada.+- 📱 **Conexión remota** — Conectate a la instancia de DSH en tu computadora desde la app móvil nativa para Android / iOS.- 🔄 **Gestión del runtime** — Instalá dependencias, elegí versiones del núcleo y accedé a actualizaciones del escritorio y del núcleo.- 🔀 **Soporte para distintos motores** — Usá DSH / Codex / Claude en una misma interfaz, con sus herramientas nativas.- 🧩 **Gestión de plugins** — 13 plugins integrados; instalación desde directorios locales, desactivación de integrados y gestión de plugins comunitarios.@@ -81,7 +82,6 @@ El asistente ofrece los siguientes plugins comunitarios para instalar a demanda.- [DSH Better Sidebar](https://github.com/omdsh-dev/DSH-better-sidebar) — Barra lateral del editor por sesión- [Billion Context](https://github.com/ranxianglei/billion-context) — Compresión de contexto y restauración del historial- [DSH Rewind](https://github.com/SiriLee/dsh-rewind) — Retroceso de conversación y backups del workspace-- [DSH Bridge](https://github.com/wenbin-wb/dsh-bridge) — Acceso remoto, túneles y conexión de bots- [DSH IM](https://github.com/xmanrui/dsh-im) — Canales IM y gestión de botsPedí preajustes nuevos o actualizados mediante [Issues](https://github.com/dsh-tauri/deepseek-harness-desktop/issues). Las versiones disponibles siguen las reglas de compatibilidad del manifiesto.@@ -119,7 +119,7 @@ brew install dsh-tauri/desktop/deepseek-harnessEl mismo repositorio también mantiene la app móvil **DSH Mobile** (Expo / React Native): descubre un host DSH en la red local y muestra la interfaz web de Harness en un WebView a pantalla completa. El código está en `src-native/`.- Los APK de Android se descargan desde la página de [Releases](https://github.com/dsh-tauri/deepseek-harness-desktop/releases) como `Deepseek.Harness.Android_x.x.x.apk`, y la versión sigue a la de escritorio.-- **iOS todavía no se publica**: solo existe el flujo de compilación y publicación de Android.+- **El IPA de iOS sin firmar se distribuye con las versiones de escritorio**; tenés que firmarlo por tu cuenta antes de instalarlo: no se puede instalar directamente.- La app móvil se mantiene **solo mientras no exista un servicio móvil oficial**, como solución transitoria.- Los comandos de desarrollo (`pnpm dev:native`, `pnpm android`, `pnpm test:native`, `pnpm typecheck:native`, etc.) y las convenciones de descubrimiento, conexión, persistencia y publicación están en la [especificación móvil](docs/specs/native.md).diff --git a/README.md b/README.mdindex 18366ca3..0c6f208f 100644--- a/README.md+++ b/README.md@@ -45,6 +45,7 @@## 功能- 🪶 **原生桌面** — Tauri 2 + React 19 + Hero 3,内嵌本地 Harness 界面。+- 📱 **远程连接** — 通过原生 Android / iOS 移动端连接电脑上的 DSH 实例。- 🔄 **运行时管理** — 安装依赖、选择内核版本,并提供桌面端与内核更新入口。- 🔀 **多内核支持** — 在同一界面畅用 DSH / Codex / Claude,发挥各自原生工具能力。- 🧩 **插件管理** — 13 个内置插件;支持本地路径安装、内置插件停用、社区插件安装、升级、卸载与错误查看。@@ -80,7 +81,6 @@- [DSH Better Sidebar](https://github.com/omdsh-dev/DSH-better-sidebar) — 按会话隔离的右编辑器侧栏- [Billion Context](https://github.com/ranxianglei/billion-context) — 上下文压缩与历史恢复- [DSH Rewind](https://github.com/SiriLee/dsh-rewind) — 对话回退与工作区备份-- [DSH Bridge](https://github.com/wenbin-wb/dsh-bridge) — 远程访问、隧道接入- [DSH IM](https://github.com/xmanrui/dsh-im) — IM 渠道与机器人管理新增或更新预设请提交 [Issue](https://github.com/dsh-tauri/deepseek-harness-desktop/issues);可用版本由清单中的内核兼容规则决定。@@ -118,7 +118,7 @@ brew install dsh-tauri/desktop/deepseek-harness同一仓库内维护移动端 **DSH Mobile**(Expo / React Native):在局域网发现 DSH 主机,并以全屏 WebView 承载 Harness 网页,源码位于 `src-native/`。- Android APK 可在 [Releases](https://github.com/dsh-tauri/deepseek-harness-desktop/releases) 页面下载,资产名形如 `Deepseek.Harness.Android_x.x.x.apk`,版本跟随桌面端。-- **iOS 尚未发布**,当前只有 Android 构建与发版流程。+- **iOS 未签名 IPA 随桌面端发版**;需自行签名后安装,不能直接安装。- 该移动端**仅在官方未推出移动端服务期间维护**,属于过渡方案。- 开发命令(`pnpm dev:native`、`pnpm android`、`pnpm test:native`、`pnpm typecheck:native` 等)与发现、连接、持久化、发版约定见[移动端规范](docs/specs/native.md)。diff --git a/app.json b/app.jsonindex f127ef44..c78b8a5e 100644--- a/app.json+++ b/app.json@@ -2,14 +2,14 @@"expo": {"name": "DSH Mobile","slug": "dsh-bridge",- "version": "0.23.1",+ "version": "0.23.2","scheme": "dshbridge","orientation": "portrait","userInterfaceStyle": "automatic","icon": "./assets/native/icon.png","android": {"package": "com.dshtauri.dshbridge",- "versionCode": 21005,+ "versionCode": 21006,"adaptiveIcon": {"foregroundImage": "./assets/native/adaptive-icon.png","backgroundColor": "#ffffff"diff --git a/docs/specs/native.md b/docs/specs/native.mdindex d9ccc76c..1486fd4c 100644--- a/docs/specs/native.md+++ b/docs/specs/native.md@@ -160,11 +160,11 @@ src-native/| Workflow | `name` | 触发 | 职责 || --- | --- | --- | --- |-| `.github/workflows/release-native.yml` | `Release Android APK (Native)` | 桌面端 `Build & Release` 完成(`workflow_run`)+ 手动 `workflow_dispatch`(输入 `tag`) | prepare → build → publish:构建 release APK,并把资产上传到**已存在的**GitHub Release |-| `.github/workflows/build-android.yml` | `Android Native Build` | push `main`(按 `src-native/**`、`app.json`、`package.json` 等 paths 过滤)+ 手动 | 常规构建,只上传 Actions artifact `android-apk-${VERSION}`(retention 14),**不碰**Release |+| `.github/workflows/release-native.yml` | `Release Mobile Apps (Native)` | 桌面端 `Build & Release` 完成(`workflow_run`)+ 手动 `workflow_dispatch`(输入 `tag`) | prepare → Android / iOS 共享构建 → publish:把 APK 与未签名 IPA 上传到**已存在的**GitHub Release |+| `.github/workflows/build-android.yml` | `Android Native Build` | `workflow_call` + 手动,不由 push / PR 触发 | 常规构建,只上传 Actions artifact `android-apk-${VERSION}`(retention 14),**不碰**Release || `.github/workflows/build-android-test.yml` | `Build Android Test` | 仅手动 `workflow_dispatch` | 复用 `build-android.yml`,产出内置 JS bundle、可脱离 Metro 运行的 release APK,artifact `android-apk-${VERSION}`(retention 14) |-* **发版只由桌面端 Release 驱动**:`release-native.yml` 只执行 `gh release upload --clobber`,**从不** create / edit Release——`release.yml` 的 finalize 是 Release 的单一 writer。该 workflow 只保留 `types: [completed]`,并在 job 级校验 `conclusion == 'success'` 与「触发运行来自本仓库」。+* **发版只由桌面端 Release 驱动**:`release-native.yml` 只执行 `gh release upload --clobber`,**从不** create / edit Release——`release.yml` 的 finalize 是 Release 的单一 writer。该 workflow 只保留 `types: [completed]`,校验整轮成功、同仓来源及 `Publish GitHub Release` job 确实成功,避免被跳过的桌面发版误触发移动端构建。* `build-android-test.yml` **不跟随 CI 自动触发**(与 build-test.yml 同样只保留 `workflow_dispatch`),避免 Android SDK / NDK / Gradle 全量编译挤占 PR 队列;需要验证 native 可编译时手动触发即可。* `build-android-test.yml` 不传签名 secret 给复用工作流,因此 release APK 使用开发证书;仍检查 16 KB 页对齐、签名、内置非空 JS bundle 与非 debuggable 标记,不依赖 Metro。@@ -172,7 +172,7 @@ src-native/* 三个 workflow 都从 `app.json` 的 `expo.version` 读取版本,并断言它等于 `package.json` 的 `version`,不一致直接 `::error::` 失败。* 三个 workflow 的资产名均为 `Deepseek.Harness.Android_<version>.apk`。版本跟随桌面端(见 §8.4)。-* 发布资产同时包含 `SHA256SUMS.txt` 与 `THIRD_PARTY_NOTICES.md`;`app.config.js` 注入的声明会在签名校验步骤里与仓库内文件比对,缺全文即失败。+* 发布资产同时包含 `SHA256SUMS-Android.txt`、`SHA256SUMS-iOS.txt` 与 `THIRD_PARTY_NOTICES.md`;`app.config.js` 注入的声明会在签名校验步骤里与仓库内文件比对,缺全文即失败。* **只有提交了 `app.json` 的 tag 才能发版**:prepare 用 `git cat-file -e "${tag_commit}:app.json"` 守卫,早于本次迁移、不含 `app.json` 的历史 tag(如 `v0.21.0`)会被正确跳过;手动指定 tag 时用 `::error::`,`workflow_run` 触发时用 `::warning::` 跳过。* 手动触发要求 dispatch 的 ref 就是 tag 指向的提交;`release.yml` 的手动试跑(`test-<ref>-<run>` 预发布)不指向其构建提交,因此不会触发 Android 发版。@@ -187,7 +187,9 @@ src-native/* 远端构建环境:JDK 17 + Android SDK(`android-36` / `build-tools 36.0.0` / NDK / CMake);`pnpm run prebuild:native` 生成原生工程后由 Gradle 编译,无需本地安装 SDK。* `app.json` 被列入 `bump.config.ts` 的 `files`,由 `patches/bumpp.patch` 增补的 `app.json` 分支在 bump 流程中同步:写入 `expo.version`,并把 `expo.android.versionCode` 递增 1(Android 要求 versionCode 严格递增),因此 `app.json` 会和 `package.json` 一起进入 release commit,不需要 `execute` 脚本或 `all`。* 本仓库根依赖由共享 catalog 固定,`react` / `react-dom` / `typescript` 与 Expo 57 期望版本不一致,`expo install --check` 在本机与 CI 上必然非零退出,因此**不**把它当门禁;原生兼容性以 `prebuild` + Gradle 编译为准。-* **iOS 尚未发布**,`bundleIdentifier` 已配置为 `com.dshtauri.dshbridge`,但无构建与发布流程。+* `build-ios.yml` 用 Expo prebuild、CocoaPods 与真机 Release 构建生成未签名 IPA,复用输入 `source_ref` 指向发布提交;`build-ios-test.yml` 仅手动调用,不随 CI 打包。+* iOS 资产名为 `Deepseek.Harness.iOS_<version>_unsigned.ipa`,artifact 为 `ios-ipa-<version>`;`bundleIdentifier` 为 `com.dshtauri.dshbridge`。构建校验非空内嵌 JS bundle 与第三方声明,不依赖 Metro。+* IPA 不含分发签名,不能直接安装或提交 App Store,需自行签名。预发布完整版本保留在资产名中,iOS `CFBundleShortVersionString` 使用三段数字核心版本。---diff --git a/src-tauri/resources/manifest.jsonc b/src-tauri/resources/manifest.jsoncindex 60f7b726..3d07494e 100644--- a/src-tauri/resources/manifest.jsonc+++ b/src-tauri/resources/manifest.jsonc@@ -224,29 +224,6 @@"checked": false,"version": "latest"},- {- "id": "@wenbin_wb/dsh-bridge",- "spec": "@wenbin_wb/dsh-bridge",- "name": "DSH Bridge",- "description": "DeepSeek Harness 多通道远程访问与安全守护插件 | 局域网扫码直连、Cloudflare / 自建公网隧道、微信 / QQ / 飞书 / Telegram 机器人全生命周期对话 | 内置全协议访问安全认证、后台防篡改与容灾保命体系",- "repo": "https://github.com/wenbin-wb/dsh-bridge",- "recommended": false,- "checked": false,- "version": [- {- "version": "^2.11.0",- "dsh": "^0.1.5-rc.1"- },- {- "version": "^2.11.3",- "dsh": "^0.1.7-rc.1"- },- {- "version": "latest",- "dsh": "^0.2.0-rc.1"- }- ]- },{"id": "@xmanrui/dsh-im","spec": "@xmanrui/dsh-im",diff --git a/src/layout/components/setup-preinstall.tsx b/src/layout/components/setup-preinstall.tsxindex 7142da96..d2f0390c 100644--- a/src/layout/components/setup-preinstall.tsx+++ b/src/layout/components/setup-preinstall.tsx@@ -1,7 +1,7 @@import type { IconComponent } from './loadable'import type { PluginProcess } from '@/store/modules/plugins'import type { PreinstallPlugin } from '@/store/modules/preinstall'-import { ArrowUpRightFromSquare, ArrowUturnCcwLeft, Comments, Copy, Cubes3Overlap, Globe, LayoutSideContentLeft, PlugConnection, ShoppingCart, Xmark } from '@gravity-ui/icons'+import { ArrowUpRightFromSquare, ArrowUturnCcwLeft, Comments, Copy, Cubes3Overlap, LayoutSideContentLeft, PlugConnection, ShoppingCart, Xmark } from '@gravity-ui/icons'import { Button, Card, Checkbox, Chip, ScrollShadow, Spinner, Switch, Typography } from '@heroui/react'import { useMount } from '@reause/core'import { invoke } from '@tauri-apps/api/core'@@ -54,7 +54,6 @@ const PLUGIN_ICONS: Record<string, IconComponent | undefined> = {'dsh-better-sidebar': LayoutSideContentLeft,'dsh-rewind-plugin': ArrowUturnCcwLeft,'billion-context': Cubes3Overlap,- '@wenbin_wb/dsh-bridge': Globe,'@xmanrui/dsh-im': Comments,}diff --git a/test/macos-build-toolchain.test.ts b/test/macos-build-toolchain.test.tsindex 708bf430..afd5ebc1 100644--- a/test/macos-build-toolchain.test.ts+++ b/test/macos-build-toolchain.test.ts@@ -6,8 +6,8 @@ import { describe, expect, it } from 'vitest'import { readSource } from './setup/read-source'const WORKFLOWS = [- ['.github/workflows/build-bundle-macos.yml', 'steps.check.outputs.should_run == \'true\'', '$/.github/actions/setup-xcode'],- ['.github/workflows/build-macos.yml', 'steps.check.outputs.should_run == \'true\'', '$/.github/actions/setup-xcode'],+ ['.github/workflows/build-bundle-macos.yml', 'steps.check.outputs.should_run == \'true\'', './.github/actions/setup-xcode'],+ ['.github/workflows/build-macos.yml', 'steps.check.outputs.should_run == \'true\'', './.github/actions/setup-xcode'],['.github/workflows/build-test.yml', undefined, './.github/actions/setup-xcode'],['.github/workflows/ci.yml', 'runner.os == \'macOS\'', './.github/actions/setup-xcode'],] as constdiff --git a/test/mobile-release-workflows.test.ts b/test/mobile-release-workflows.test.tsnew file mode 100644index 00000000..c2713c82--- /dev/null+++ b/test/mobile-release-workflows.test.ts@@ -0,0 +1,145 @@+import type { VersionBumpOptions } from 'bumpp'+import { spawnSync } from 'node:child_process'+import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'+import { tmpdir } from 'node:os'+import { join } from 'node:path'+import { versionBump } from 'bumpp'+import { describe, expect, it } from 'vitest'+import bumpConfig from '../bump.config'+import { readSource } from './setup/read-source'++const android = readSource('.github/workflows/build-android.yml')+const ios = readSource('.github/workflows/build-ios.yml')+const release = readSource('.github/workflows/release-native.yml')++function section(source: string, key: string, indent = 0): string {+ const body = source.match(new RegExp(`^${' '.repeat(indent)}${key}:([\\s\\S]*?)(?=^ {0,${indent}}\\S|(?![\\s\\S]))`, 'm'))?.[1]+ expect(body, key).toBeTypeOf('string')+ return body!+}++function scratch<T>(run: (directory: string) => T): T {+ const directory = mkdtempSync(join(tmpdir(), 'mobile-release-'))+ try {+ return run(directory)+ }+ finally {+ rmSync(directory, { recursive: true, force: true })+ }+}++describe('mobile release workflow contracts', () => {+ it.each([+ ['Android build', android, ['workflow_dispatch', 'workflow_call']],+ ['Android test', readSource('.github/workflows/build-android-test.yml'), ['workflow_dispatch']],+ ['iOS build', ios, ['workflow_call']],+ ['iOS test', readSource('.github/workflows/build-ios-test.yml'), ['workflow_dispatch']],+ ])('%s packages only on explicit or reusable workflow triggers', (_name, source, triggers) => {+ const events = [...section(source, 'on').matchAll(/^ {2}(\w+):/gm)].map(match => match[1])+ expect(events).toEqual(triggers)+ expect(section(source, 'permissions')).toContain('contents: read')+ expect(source).not.toMatch(/contents: write|gh release (?:create|edit|upload)/)+ })++ it('follows successful same-repository desktop releases without writing release metadata', () => {+ expect(section(release, 'on')).toContain('workflows: [\'Build & Release\']')+ expect(section(release, 'on')).toContain('types: [completed]')+ expect(readSource('.github/workflows/release.yml')).toMatch(/^name: Build & Release$/m)+ const prepare = section(release, 'prepare', 2)+ expect(prepare).toContain('github.event.workflow_run.conclusion == \'success\'')+ expect(prepare).toContain('github.event.workflow_run.head_repository.full_name == github.repository')+ expect(prepare).toContain('github.event.workflow_run.head_sha || github.sha')+ expect(prepare).toContain('persist-credentials: false')+ expect(prepare).toContain('actions: read')+ expect(prepare).toContain(`RUN_ID: \${{ github.event.workflow_run.id }}`)+ expect(section(release, 'permissions')).toContain('contents: read')+ expect(section(release, 'publish', 2)).toContain('contents: write')+ expect(release).not.toMatch(/gh release (?:create|edit)/)+ })++ it.each([+ ['push', 'v0.23.3-beta.0', 'success', true],+ ['push', 'main', 'success', true],+ ['pull_request', 'release/v0.23.3-beta.0', 'success', true],+ ['pull_request', 'release/v0.23.3-beta.0', 'skipped', false],+ ['pull_request', 'feature/native', 'skipped', false],+ ['push', 'main', 'failure', false],+ ['push', 'main', '', false],+ ['workflow_dispatch', 'main', 'success', false],+ ])('desktop %s from %s with finalize %s enables mobile builds: %s', (event, branch, finalized, allowed) => {+ const script = release.match(/ {6}- name: Resolve release tag\n[\s\S]*? {8}run: \|\n([\s\S]*?)(?=^ {2}\S)/m)?.[1]+ expect(script).toBeTypeOf('string')+ const result = scratch((directory) => {+ const output = join(directory, 'output')+ const executed = spawnSync(process.platform === 'win32' ? 'C:/Program Files/Git/bin/bash.exe' : 'bash', ['-c', `+ node() { printf '%s\\n' '0.23.3-beta.0'; }+ gh() {+ if [ "$1" = run ]; then+ [ "$2" = view ] && [ "$3" = 123 ] && [ "$4" = --json ] && [ "$5" = jobs ] && [ "$6" = --jq ] && [ "$7" = '.jobs[] | select(.name == "Publish GitHub Release") | .conclusion' ] || return 1+ printf '%s\\n' "$FINALIZE_CONCLUSION"+ fi+ }+ git() { if [ "$1" = rev-parse ]; then printf '%s\\n' 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'; fi; }+ ${script}+ `], {+ stdio: 'ignore',+ timeout: 10000,+ env: { ...process.env, EVENT_NAME: 'workflow_run', TRIGGER_EVENT: event, RUN_HEAD_BRANCH: branch, RUN_ID: '123', FINALIZE_CONCLUSION: finalized, TAG_INPUT: '', GITHUB_OUTPUT: output.replace(/\\/g, '/') },+ })+ expect(executed.error).toBeUndefined()+ expect(executed.status).toBe(0)+ return readFileSync(output, 'utf8')+ })+ expect(result).toContain(`should_build=${allowed}\n`)+ expect(result).toContain(`source_ref=${allowed ? 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' : ''}\n`)+ })++ it.each([+ ['build', android, 'android-apk', `Deepseek.Harness.Android_\${VERSION}.apk`, 'SHA256SUMS-Android.txt'],+ ['build-ios', ios, 'ios-ipa', `Deepseek.Harness.iOS_\${VERSION}_unsigned.ipa`, 'SHA256SUMS-iOS.txt'],+ ])('%s builds the resolved release commit and publishes its exact artifact contract', (job, source, artifact, asset, checksum) => {+ expect(section(source, 'on')).toContain('source_ref:')+ expect(section(source, 'on')).toContain('type: string')+ expect(section(source, 'on')).toContain(`value: \${{ jobs.build.outputs.version }}`)+ expect(source).toMatch(/ref: \$\{\{ inputs\.source_ref(?: \|\| github\.sha)? \}\}/)+ expect(source).toContain('persist-credentials: false')+ const build = section(release, job, 2)+ expect(build).toContain('if: needs.prepare.outputs.should_build == \'true\'')+ expect(build).toContain(`source_ref: \${{ needs.prepare.outputs.source_ref }}`)+ expect(source).toContain(`name: ${artifact}-\${{ steps.meta.outputs.version }}`)+ expect(source).toContain('if-no-files-found: error')+ expect(source).toContain(asset)+ expect(source).toContain(`> ${checksum}`)+ const publish = section(release, 'publish', 2)+ expect(publish).toContain(`needs.${job}.result == 'success'`)+ expect(publish).toContain(`name: ${artifact}-\${{ needs.${job}.outputs.version }}`)+ expect(publish).toContain(asset)+ expect(publish).toContain(`release/${checksum}`)+ expect(publish).toContain(`RELEASE_TAG: \${{ needs.prepare.outputs.tag }}`)+ expect(publish).toContain('gh release upload "$RELEASE_TAG"')+ })++ it('keeps the native version synchronized with the desktop version', () => {+ expect(JSON.parse(readSource('app.json')).expo.version).toBe(JSON.parse(readSource('package.json')).version)+ expect(bumpConfig.files).toContain('app.json')+ })++ it('installed bumpp updates Expo beta version and increments Android versionCode once', async () => {+ const directory = mkdtempSync(join(tmpdir(), 'mobile-bump-'))+ try {+ writeFileSync(join(directory, 'package.json'), JSON.stringify({ name: 'mobile-bump-test', version: '0.23.2' }))+ writeFileSync(join(directory, 'app.json'), JSON.stringify({ expo: { version: '0.23.2', android: { versionCode: 21006 }, extra: { keep: '0.23.2' } } }))+ const options = { cwd: directory, files: ['package.json', 'app.json'], release: '0.23.3-beta.0', commit: false, tag: false, push: false, install: false, confirm: false, ignoreScripts: true, interface: false, printCommits: false } satisfies VersionBumpOptions+ const result = await versionBump(options)+ expect(result.updatedFiles).toContain(join(directory, 'app.json'))+ expect(JSON.parse(readFileSync(join(directory, 'package.json'), 'utf8')).version).toBe('0.23.3-beta.0')+ const expected = { expo: { version: '0.23.3-beta.0', android: { versionCode: 21007 }, extra: { keep: '0.23.2' } } }+ expect(JSON.parse(readFileSync(join(directory, 'app.json'), 'utf8'))).toEqual(expected)+ await versionBump(options)+ expect(JSON.parse(readFileSync(join(directory, 'app.json'), 'utf8'))).toEqual(expected)+ }+ finally {+ rmSync(directory, { recursive: true, force: true })+ }+ })+})diff --git a/test/plugin-presets.test.ts b/test/plugin-presets.test.tsindex 3d82fca4..7cb22b77 100644--- a/test/plugin-presets.test.ts+++ b/test/plugin-presets.test.ts@@ -4,11 +4,17 @@ import { stripJsonc } from '../scripts/bundle-metadata.mjs'const manifest = JSON.parse(stripJsonc(readFileSync(new URL('../src-tauri/resources/manifest.jsonc', import.meta.url), 'utf8'),-)) as { plugins: { preset: { id: string }[] } }+)) as { plugins: { 'preset': { id: string }[], 'built-in': { id: string }[], 'depercated': string[] } }const presets = manifest.plugins.presetdescribe('community plugin presets', () => {+ it('removes DSH Bridge from install presets without marking existing installs for removal', () => {+ expect(presets.map(plugin => plugin.id)).not.toContain('@wenbin_wb/dsh-bridge')+ expect(manifest.plugins['built-in'].map(plugin => plugin.id)).not.toContain('@wenbin_wb/dsh-bridge')+ expect(manifest.plugins.depercated).not.toContain('@wenbin_wb/dsh-bridge')+ })+it('keeps DSH IM optional without the recommended badge', () => {expect(presets.filter(plugin => plugin.id === '@xmanrui/dsh-im')).toMatchObject([{ spec: '@xmanrui/dsh-im', recommended: false, checked: false },