An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:construction_worker: Trim the changelog during packaging (#17987)
Jeffrey Chend1bcef2d12dc
diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.ymlindex 0b22b396d9..a28becec0c 100644--- a/.github/workflows/cd.yml+++ b/.github/workflows/cd.yml@@ -331,7 +331,8 @@ jobs:cp ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/kernel/kernel.aar \${{ github.workspace }}/siyuan-android/app/libs/kernel.aarcd ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app- zip -r app.zip appearance guide stage changelogs+ node scripts/trimChangelogs.js+ zip -r app.zip appearance guide stage $([ -d changelogs ] && echo changelogs)mkdir -p ${{ github.workspace }}/siyuan-android/app/src/main/assetscp app.zip ${{ github.workspace }}/siyuan-android/app/src/main/assets/app.zipdiff --git a/Dockerfile b/Dockerfileindex 817f556943..55d4407d61 100644--- a/Dockerfile+++ b/Dockerfile@@ -19,7 +19,8 @@ RUN <<EORUNpnpm run buildnode scripts/trimChangelogs.jsmkdir /artifacts-mv appearance stage guide changelogs /artifacts/+mv appearance stage guide /artifacts/+if [ -d changelogs ]; then mv changelogs /artifacts/; fiEORUNFROM golang:1.25-alpine AS go-builddiff --git a/app/scripts/afterPack.js b/app/scripts/afterPack.jsindex 80c379328f..b6bd723f1b 100644--- a/app/scripts/afterPack.js+++ b/app/scripts/afterPack.js@@ -24,7 +24,9 @@ async function trimPackagedChangelogs(appOutDir, packager, platform) {console.error(`trimChangelogs: ${result.reason}`);return;}- console.log(`trimChangelogs: ${result.path}`);+ if (result.path) {+ console.log(`trimChangelogs: ${result.path}`);+ }} catch (error) {console.error("Failed to trim changelogs:", error.message);}diff --git a/app/scripts/trimChangelogs.js b/app/scripts/trimChangelogs.jsindex a95d82c954..4cd4d27306 100644--- a/app/scripts/trimChangelogs.js+++ b/app/scripts/trimChangelogs.js@@ -1,12 +1,25 @@const fsPromises = require("fs").promises;const path = require("path");-// 裁剪 changelog,只保留顶层 changelogs/v{version}/。+// 裁剪 changelog,只保留顶层 changelogs/v{version}/;预发布版删除整个 changelogs 目录。// 版本号须与 package.json、kernel/util/working.go 的 Ver 一致(内核按此路径读取)。async function trimChangelogs(changelogsDir, version) {+ let exists = true;try {await fsPromises.access(changelogsDir);} catch {+ exists = false;+ }++ if (version.includes("-")) {+ // 预发布版+ if (exists) {+ await fsPromises.rm(changelogsDir, {recursive: true, force: true});+ }+ return {ok: true};+ }++ if (!exists) {return {ok: false, reason: "directory not found"};}@@ -48,7 +61,9 @@ if (require.main === module) {console.error(`trimChangelogs: ${result.reason}`);return;}- console.log(`trimChangelogs: ${result.path}`);+ if (result.path) {+ console.log(`trimChangelogs: ${result.path}`);+ }}).catch((error) => {console.error("trimChangelogs failed:", error.message);});