Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ jobs:
cp ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/kernel/kernel.aar \
${{ github.workspace }}/siyuan-android/app/libs/kernel.aar
cd ${{ 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/assets
cp app.zip ${{ github.workspace }}/siyuan-android/app/src/main/assets/app.zip

Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ RUN <<EORUN
pnpm run build
node scripts/trimChangelogs.js
mkdir /artifacts
mv appearance stage guide changelogs /artifacts/
mv appearance stage guide /artifacts/
if [ -d changelogs ]; then mv changelogs /artifacts/; fi
EORUN

FROM golang:1.25-alpine AS go-build
Expand Down
4 changes: 3 additions & 1 deletion app/scripts/afterPack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
19 changes: 17 additions & 2 deletions app/scripts/trimChangelogs.js
Original file line number Diff line number Diff line change
@@ -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"};
}

Expand Down Expand Up @@ -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);
});
Expand Down
Loading