AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
ci: reuse unchanged native release assets
tianma-if2effb668089c
diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.ymlindex 98daeef5..20cfd421 100644--- a/.github/workflows/desktop-build.yml+++ b/.github/workflows/desktop-build.yml@@ -9,7 +9,86 @@ permissions:contents: writejobs:+ release-plan:+ if: github.repository == 'tianma-if/edgeever' && github.event_name == 'release'+ name: Plan desktop release asset+ runs-on: ubuntu-latest+ outputs:+ previous_tag: ${{ steps.plan.outputs.previous_tag }}+ rebuild: ${{ steps.plan.outputs.rebuild }}+ steps:+ - name: Check out source+ uses: actions/checkout@v5+ with:+ fetch-depth: 0++ - name: Compare with previous formal release+ id: plan+ env:+ CURRENT_TAG: ${{ github.event.release.tag_name }}+ GH_TOKEN: ${{ github.token }}+ run: |+ mapfile -t release_tags < <(+ gh api "repos/${GITHUB_REPOSITORY}/releases?per_page=100" \+ --jq '.[] | select(.draft == false and .prerelease == false) | .tag_name'+ )+ previous_tag=""+ for release_tag in "${release_tags[@]}"; do+ if [[ "$release_tag" != "$CURRENT_TAG" ]]; then+ previous_tag="$release_tag"+ break+ fi+ done+ test -n "$previous_tag"+ git fetch origin "refs/tags/${previous_tag}:refs/tags/${previous_tag}"+ echo "previous_tag=$previous_tag" >> "$GITHUB_OUTPUT"+ node scripts/plan-native-release.mjs desktop "$previous_tag" "$CURRENT_TAG" >> "$GITHUB_OUTPUT"++ reuse-release-desktop:+ needs: release-plan+ if: >-+ ${{+ github.repository == 'tianma-if/edgeever' &&+ github.event_name == 'release' &&+ needs.release-plan.result == 'success' &&+ needs.release-plan.outputs.rebuild == 'false'+ }}+ name: Reuse macOS release assets+ runs-on: ubuntu-latest+ steps:+ - name: Copy latest compatible macOS assets without renaming+ env:+ CURRENT_TAG: ${{ github.event.release.tag_name }}+ GH_TOKEN: ${{ github.token }}+ PREVIOUS_TAG: ${{ needs.release-plan.outputs.previous_tag }}+ run: |+ mkdir -p "$RUNNER_TEMP/native-assets"+ gh release download "$PREVIOUS_TAG" \+ --repo "$GITHUB_REPOSITORY" \+ --pattern 'EdgeEver-*-mac-arm64.dmg' \+ --pattern 'EdgeEver-*-mac-arm64.dmg.blockmap' \+ --pattern 'latest-mac.yml' \+ --dir "$RUNNER_TEMP/native-assets"+ test "$(find "$RUNNER_TEMP/native-assets" -type f | wc -l | tr -d ' ')" = "3"+ gh release upload "$CURRENT_TAG" "$RUNNER_TEMP/native-assets/"* \+ --repo "$GITHUB_REPOSITORY" \+ --clobber+desktop:+ needs: release-plan+ if: >-+ ${{+ always() &&+ github.repository == 'tianma-if/edgeever' &&+ (+ github.event_name == 'workflow_dispatch' ||+ (+ github.event_name == 'release' &&+ needs.release-plan.result == 'success' &&+ needs.release-plan.outputs.rebuild == 'true'+ )+ )+ }}name: macOS arm64runs-on: macos-14diff --git a/.github/workflows/mobile-build.yml b/.github/workflows/mobile-build.ymlindex b6121206..d7206b4e 100644--- a/.github/workflows/mobile-build.yml+++ b/.github/workflows/mobile-build.yml@@ -16,10 +16,8 @@ on:- "apps/mobile/**"- "packages/client/**"- "packages/shared/**"- - "package.json"- "bun.lock"- "scripts/build-android-local.sh"- - ".github/workflows/mobile-build.yml"permissions:contents: write@@ -29,8 +27,85 @@ concurrency:cancel-in-progress: truejobs:+ release-plan:+ if: github.repository == 'tianma-if/edgeever' && github.event_name == 'release'+ name: Plan Android release asset+ runs-on: ubuntu-latest+ outputs:+ previous_tag: ${{ steps.plan.outputs.previous_tag }}+ rebuild: ${{ steps.plan.outputs.rebuild }}+ steps:+ - name: Checkout+ uses: actions/checkout@v5+ with:+ fetch-depth: 0++ - name: Compare with previous formal release+ id: plan+ env:+ CURRENT_TAG: ${{ github.event.release.tag_name }}+ GH_TOKEN: ${{ github.token }}+ run: |+ mapfile -t release_tags < <(+ gh api "repos/${GITHUB_REPOSITORY}/releases?per_page=100" \+ --jq '.[] | select(.draft == false and .prerelease == false) | .tag_name'+ )+ previous_tag=""+ for release_tag in "${release_tags[@]}"; do+ if [[ "$release_tag" != "$CURRENT_TAG" ]]; then+ previous_tag="$release_tag"+ break+ fi+ done+ test -n "$previous_tag"+ git fetch origin "refs/tags/${previous_tag}:refs/tags/${previous_tag}"+ echo "previous_tag=$previous_tag" >> "$GITHUB_OUTPUT"+ node scripts/plan-native-release.mjs mobile "$previous_tag" "$CURRENT_TAG" >> "$GITHUB_OUTPUT"++ reuse-release-apk:+ needs: release-plan+ if: >-+ ${{+ github.repository == 'tianma-if/edgeever' &&+ github.event_name == 'release' &&+ needs.release-plan.result == 'success' &&+ needs.release-plan.outputs.rebuild == 'false'+ }}+ name: Reuse Android release APK+ runs-on: ubuntu-latest+ steps:+ - name: Copy latest compatible APK without renaming+ env:+ CURRENT_TAG: ${{ github.event.release.tag_name }}+ GH_TOKEN: ${{ github.token }}+ PREVIOUS_TAG: ${{ needs.release-plan.outputs.previous_tag }}+ run: |+ mkdir -p "$RUNNER_TEMP/native-assets"+ gh release download "$PREVIOUS_TAG" \+ --repo "$GITHUB_REPOSITORY" \+ --pattern 'edgeever-android-v*-arm64-v8a.apk' \+ --dir "$RUNNER_TEMP/native-assets"+ test "$(find "$RUNNER_TEMP/native-assets" -type f -name 'edgeever-android-v*-arm64-v8a.apk' | wc -l | tr -d ' ')" = "1"+ gh release upload "$CURRENT_TAG" "$RUNNER_TEMP/native-assets/"* \+ --repo "$GITHUB_REPOSITORY" \+ --clobber+android:- if: github.repository == 'tianma-if/edgeever' && (github.event_name == 'workflow_dispatch' || github.event_name == 'release' || github.ref == 'refs/heads/main')+ needs: release-plan+ if: >-+ ${{+ always() &&+ github.repository == 'tianma-if/edgeever' &&+ (+ github.event_name == 'workflow_dispatch' ||+ github.ref == 'refs/heads/main' ||+ (+ github.event_name == 'release' &&+ needs.release-plan.result == 'success' &&+ needs.release-plan.outputs.rebuild == 'true'+ )+ )+ }}name: Build Android packagesruns-on: [self-hosted, macOS, ARM64, edgeever-mobile]timeout-minutes: 45diff --git a/AGENTS.md b/AGENTS.mdindex 78180404..6955ee85 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -11,9 +11,9 @@## GitHub Release 约束与流程1. **版本号与基线**:使用 `vX.Y.Z` 格式(非 Draft/Prerelease)。递增根目录 `package.json`;若含移动端修改,同步更新 `apps/mobile/app.json` 的 `expo.version` 并递增 `android.versionCode`。上一个实际 Release 为审计基线。-2. **跨平台 Release 资产**:每个正式 Release 页面必须同时包含当前版本的 macOS arm64 DMG 和 Android arm64 APK;APK 命名为 `edgeever-android-vX.Y.Z-arm64-v8a.apk`。+2. **跨平台 Release 资产**:每个正式 Release 页面必须同时包含 macOS arm64 DMG 和 Android arm64 APK。若本次未修改对应原生运行时代码、依赖、配置或构建工具,直接复用上一个正式 Release 中已验证的原始资产,保留原文件名与校验和,禁止仅为匹配新版本号而重命名。3. **验证命令**:必须通过 `bun run typecheck`、`bun run typecheck:mobile` 和 `bun run build:web`。-4. **APK 构建与签名**:仅当变更影响移动端运行时代码、共享依赖、原生配置或构建工具时,执行 `bun run build:android:apk:local` 构建生产签名 APK,命名为 `edgeever-android-vX.Y.Z-arm64-v8a.apk`(签名配置必须位于仓库外 `~/.config/edgeever/android/signing.env`)。无移动端变更时复用最近兼容 APK。+4. **原生资产构建与复用**:仅当变更影响移动端运行时代码、共享依赖、原生配置或 Android 构建工具时,执行 `bun run build:android:apk:local` 构建生产签名 APK(签名配置必须位于仓库外 `~/.config/edgeever/android/signing.env`);仅当变更影响 Electron、Rust sidecar、原生依赖、打包配置或桌面构建工具时重新构建 macOS DMG。无对应原生变更时,由 Release 工作流复用最近兼容资产。5. **Release 说明结构**:使用中英文双语格式(正文禁止包含字面量 `\n`)。功能/修复关联对应 Issue 并标记 Label,发布后回链并关闭 Issue。正文结构:```md@@ -38,7 +38,6 @@ Related Issue: #<issue-number>## 验证- 列出实际完成的测试、类型检查和构建结果。-```## 环境、部署与组件约束diff --git a/apps/desktop/README.md b/apps/desktop/README.mdindex c34f1ded..53a1473f 100644--- a/apps/desktop/README.md+++ b/apps/desktop/README.md@@ -39,8 +39,12 @@ When these secrets are absent, CI produces unsigned verification artifacts.Private signing material is never committed to the repository.The workflow keeps `workflow_dispatch` builds as non-publishing verification-runs. When a GitHub Release is published, each platform job publishes its-installer and update metadata to that release through electron-builder.+runs. When a GitHub Release is published, the workflow first compares it with+the previous formal Release. It rebuilds and publishes the installer through+electron-builder only when Electron, the Rust sidecar, native dependencies,+packaging configuration, or desktop build tooling changed. Web-only Releases+reuse the previous verified DMG, blockmap, and update metadata without renaming+them, so the macOS runner and signing pipeline are not scheduled unnecessarily.The desktop Settings page exposes the sidecar's local backup list. Restoring abackup creates an additional protective backup first, restores the SQLitediff --git a/docs/mobile-build.md b/docs/mobile-build.mdindex 1cceadfb..595ef931 100644--- a/docs/mobile-build.md+++ b/docs/mobile-build.md@@ -46,6 +46,12 @@ This produces `apps/mobile/android/app/build/outputs/apk/release/app-release.apkIf the audited change range does not affect the mobile binary, the most recent compatible, verified APK may be attached again without rebuilding. Keep its original versioned filename and checksum, and state the source release explicitly; never rename an older binary to the current release version.+The release workflow performs this audit automatically. Web-only releases use+an Ubuntu planning job and copy the single verified `arm64-v8a` APK from the+previous formal Release. The self-hosted Android runner is scheduled only when+the audited range includes mobile runtime code, shared mobile packages,+dependencies, native configuration, or Android build tooling.+### Recommended local Play buildRoutine Google Play bundles should be built on the release Mac instead of indiff --git a/package.json b/package.jsonindex 99348f49..2464fbf5 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "edgeever",- "version": "1.6.30",+ "version": "1.6.31","private": true,"type": "module","workspaces": [diff --git a/scripts/plan-native-release.mjs b/scripts/plan-native-release.mjsnew file mode 100644index 00000000..a93cf981--- /dev/null+++ b/scripts/plan-native-release.mjs@@ -0,0 +1,65 @@+import { execFileSync } from "node:child_process";++const [platform, baseRef, headRef] = process.argv.slice(2);++if (!["mobile", "desktop"].includes(platform) || !baseRef || !headRef) {+ console.error(+ "Usage: node scripts/plan-native-release.mjs <mobile|desktop> <base-ref> <head-ref>",+ );+ process.exit(1);+}++const git = (...args) =>+ execFileSync("git", args, {+ encoding: "utf8",+ }).trim();++const changedFiles = git("diff", "--name-only", `${baseRef}...${headRef}`)+ .split("\n")+ .filter(Boolean);++const packageJsonChangedBeyondVersion = () => {+ if (!changedFiles.includes("package.json")) return false;++ const readPackage = (ref) => {+ const packageJson = JSON.parse(git("show", `${ref}:package.json`));+ delete packageJson.version;+ return packageJson;+ };++ return (+ JSON.stringify(readPackage(baseRef)) !==+ JSON.stringify(readPackage(headRef))+ );+};++const relevantPrefixes =+ platform === "mobile"+ ? ["apps/mobile/", "packages/client/", "packages/shared/"]+ : ["apps/desktop/", "crates/desktop-sidecar/"];++const relevantFiles =+ platform === "mobile"+ ? new Set(["bun.lock", "scripts/build-android-local.sh"])+ : new Set([+ "scripts/run-desktop-builder.mjs",+ "scripts/verify-desktop-package.mjs",+ ]);++const relevantChanges = changedFiles.filter(+ (file) =>+ relevantPrefixes.some((prefix) => file.startsWith(prefix)) ||+ relevantFiles.has(file) ||+ (platform === "mobile" &&+ file === "package.json" &&+ packageJsonChangedBeyondVersion()),+);++const rebuild = relevantChanges.length > 0;++process.stdout.write(`rebuild=${rebuild}\n`);+process.stderr.write(+ `${platform} release plan: ${rebuild ? "rebuild" : "reuse"}${+ relevantChanges.length > 0 ? ` (${relevantChanges.join(", ")})` : ""+ }\n`,+);