Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 62804ec

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feature/update_electron
2 parents 338012e + 4edb037 commit 62804ec

19 files changed

+8339
-17601
lines changed

.github/workflows/dev.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
name: Dev
22
on:
33
push:
4-
branches:
5-
- '!develop'
6-
- '!feature/update*'
4+
branches-ignore:
5+
- 'develop'
6+
- 'feature/update**'
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
712
jobs:
813
build_docker:
914
name: Build Docker image

.github/workflows/main.yml

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ on:
44
branches:
55
- 'develop'
66
- 'feature/update*'
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
712
env:
813
REGISTRY: ghcr.io
914
IMAGE_NAME: ${{ github.repository }}
15+
1016
jobs:
1117
build_darwin-x64:
1218
name: Build macOS x86_64
@@ -19,7 +25,9 @@ jobs:
1925
node-version: 20
2026
cache: "npm"
2127
- run: npm ci
22-
- run: ./bin/build-mac-x64.sh
28+
- run: |
29+
npm run update-build-info
30+
./bin/build-mac-x64.sh
2331
- uses: actions/upload-artifact@v4
2432
with:
2533
name: trilium-mac-x64.zip
@@ -35,7 +43,9 @@ jobs:
3543
node-version: 20
3644
cache: "npm"
3745
- run: npm ci
38-
- run: ./bin/build-mac-arm64.sh
46+
- run: |
47+
npm run update-build-info
48+
./bin/build-mac-arm64.sh
3949
- uses: actions/upload-artifact@v4
4050
with:
4151
name: trilium-mac-arm64.zip
@@ -51,7 +61,9 @@ jobs:
5161
node-version: 20
5262
cache: "npm"
5363
- run: npm ci
54-
- run: ./bin/build-linux-x64.sh
64+
- run: |
65+
npm run update-build-info
66+
./bin/build-linux-x64.sh
5567
- uses: actions/upload-artifact@v4
5668
with:
5769
name: trilium-linux-x64.tar.xz
@@ -71,7 +83,9 @@ jobs:
7183
node-version: 20
7284
cache: "npm"
7385
- run: npm ci
74-
- run: ./bin/build-server.sh
86+
- run: |
87+
npm run update-build-info
88+
./bin/build-server.sh
7589
- uses: actions/upload-artifact@v4
7690
with:
7791
name: trilium-linux-x64-server.tar.xz
@@ -94,11 +108,33 @@ jobs:
94108
node-version: 20
95109
cache: "npm"
96110
- run: npm ci
97-
- run: ./bin/build-win-x64.sh
111+
- run: |
112+
npm run update-build-info
113+
./bin/build-win-x64.sh DONTPACK
98114
- uses: actions/upload-artifact@v4
99115
with:
100-
name: trilium-windows-x64.zip
101-
path: dist/trilium-windows-x64-*.zip
116+
name: trilium-windows-x64
117+
path: dist/trilium-windows-x64
118+
build_windows-installer:
119+
name: Build Windows x86_64 (Setup)
120+
runs-on: windows-latest
121+
steps:
122+
- uses: actions/checkout@v4
123+
- name: Set up node & dependencies
124+
uses: actions/setup-node@v4
125+
with:
126+
node-version: 20
127+
cache: "npm"
128+
- run: npm ci
129+
- name: Run installer build
130+
run: |
131+
npm run update-build-info
132+
npm run make-electron
133+
- name: Publish installer artifact
134+
uses: actions/upload-artifact@v4
135+
with:
136+
name: TriliumNext Notes for Windows (Setup)
137+
path: out/make/squirrel.windows/x64/*.exe
102138
build_docker:
103139
name: Build Docker image
104140
runs-on: ubuntu-latest

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ data/
1515
data-test/
1616
tmp/
1717
.eslintcache
18+
19+
out/

bin/build-linux-x64.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ echo "Packaging linux x64 electron build"
3535
BUILD_DIR=./dist/trilium-linux-x64
3636
rm -rf "$BUILD_DIR"
3737

38-
mv "./dist/Trilium Notes-linux-x64" "$BUILD_DIR"
38+
mv "./dist/TriliumNext Notes-linux-x64" "$BUILD_DIR"
3939

4040
cp images/app-icons/png/128x128.png "$BUILD_DIR"/icon.png
4141
cp bin/tpl/anonymize-database.sql "$BUILD_DIR"/

bin/build-mac-arm64.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ BUILD_DIR=./dist/trilium-mac-arm64
2121
rm -rf $BUILD_DIR
2222

2323
# Mac build has by default useless directory level
24-
mv "./dist/Trilium Notes-darwin-arm64" $BUILD_DIR
24+
mv "./dist/TriliumNext Notes-darwin-arm64" $BUILD_DIR
2525

2626
cp bin/tpl/anonymize-database.sql $BUILD_DIR/
2727

bin/build-mac-x64.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ BUILD_DIR=./dist/trilium-mac-x64
2121
rm -rf $BUILD_DIR
2222

2323
# Mac build has by default useless directory level
24-
mv "./dist/Trilium Notes-darwin-x64" $BUILD_DIR
24+
mv "./dist/TriliumNext Notes-darwin-x64" $BUILD_DIR
2525

2626
cp bin/tpl/anonymize-database.sql $BUILD_DIR/
2727

bin/build-win-x64.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ echo "Packaging windows x64 electron build"
2525
BUILD_DIR=./dist/trilium-windows-x64
2626
rm -rf $BUILD_DIR
2727

28-
mv "./dist/Trilium Notes-win32-x64" $BUILD_DIR
28+
mv "./dist/TriliumNext Notes-win32-x64" $BUILD_DIR
2929

3030
cp bin/tpl/anonymize-database.sql $BUILD_DIR/
3131

@@ -34,9 +34,11 @@ rm -rf $BUILD_DIR/dump-db/node_modules
3434

3535
cp bin/tpl/trilium-{portable,no-cert-check,safe-mode}.bat $BUILD_DIR/
3636

37-
echo "Zipping windows x64 electron distribution..."
38-
VERSION=`jq -r ".version" package.json`
39-
40-
cd dist
37+
if [ "$1" != "DONTPACK" ]
38+
then
39+
echo "Zipping windows x64 electron distribution..."
40+
VERSION=`jq -r ".version" package.json`
4141

42-
zip -r9 trilium-windows-x64-${VERSION}.zip trilium-windows-x64
42+
cd dist
43+
zip -r9 trilium-windows-x64-${VERSION}.zip trilium-windows-x64
44+
fi

bin/copy-trilium.sh

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,36 @@ for f in 'package.json' 'package-lock.json' 'README.md' 'LICENSE' 'config-sample
3535
cp "$f" "$DIR"/
3636
done
3737

38+
# Patch package.json main
39+
sed -i 's/.\/dist\/electron.js/electron.js/g' "$DIR/package.json"
40+
3841
script_dir=$(realpath $(dirname $0))
39-
cp -Rv "$script_dir/../build/src" "$DIR"
42+
cp -R "$script_dir/../build/src" "$DIR"
4043
cp "$script_dir/../build/electron.js" "$DIR"
4144

4245
# run in subshell (so we return to original dir)
43-
(cd $DIR && npm install --only=prod)
44-
(cd $DIR && npm run switch-electron)
46+
(cd $DIR && npm install --omit=dev)
4547

4648
if [[ -d "$DIR"/node_modules ]]; then
47-
# cleanup of useless files in dependencies
48-
for d in 'image-q/demo' 'better-sqlite3/Release' 'better-sqlite3/deps/sqlite3.tar.gz' '@jimp/plugin-print/fonts' 'jimp/browser' 'jimp/fonts'; do
49-
[[ -e "$DIR"/node_modules/"$d" ]] && rm -rv "$DIR"/node_modules/"$d"
49+
# cleanup of useless files in dependencies
50+
for d in 'image-q/demo' \
51+
'@excalidraw/excalidraw/dist/excalidraw-assets-dev' '@excalidraw/excalidraw/dist/excalidraw.development.js' '@excalidraw/excalidraw/dist/excalidraw-with-preact.development.js' \
52+
'mermaid/dist/mermaid.js' \
53+
'boxicons/svg' 'boxicons/node_modules/react'/* \
54+
'better-sqlite3/Release' 'better-sqlite3/deps/sqlite3.tar.gz' 'better-sqlite3/deps/sqlite3' \
55+
'@jimp/plugin-print/fonts' 'jimp/browser' 'jimp/fonts'; do
56+
[[ -e "$DIR"/node_modules/"$d" ]] && rm -r "$DIR"/node_modules/"$d"
5057
done
5158

52-
# delete all tests (there are often large images as test file for jimp etc.)
53-
for d in 'test' 'docs' 'demo'; do
54-
find "$DIR"/node_modules -name "$d" -exec rm -rf {} \;
59+
# delete all tests (there are often large images as test file for jimp etc.)
60+
for d in 'test' 'docs' 'demo' 'example'; do
61+
find "$DIR"/node_modules -name "$d" -exec rm -rf {} +
5562
done
5663
fi
5764

5865
find $DIR/libraries -name "*.map" -type f -delete
66+
find $DIR/node_modules -name "*.map" -type f -delete
67+
find $DIR -name "*.ts" -type f -delete
5968

6069
d="$DIR"/src/public
6170
[[ -d "$d"/app-dist ]] || mkdir -pv "$d"/app-dist

bin/release.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ mv package.json.tmp package.json
3232

3333
git add package.json
3434

35-
echo 'export = { buildDate:"'`date --iso-8601=seconds`'", buildRevision: "'`git log -1 --format="%H"`'" };' > src/services/build.ts
35+
npm run update-build-info
3636

3737
git add src/services/build.ts
3838

@@ -65,7 +65,9 @@ if [[ $TAG == *"beta"* ]]; then
6565
EXTRA=--prerelease
6666
fi
6767

68-
echo "$GITHUB_CLI_AUTH_TOKEN" | gh auth login --with-token
68+
if [ ! -z "$GITHUB_CLI_AUTH_TOKEN" ]; then
69+
echo "$GITHUB_CLI_AUTH_TOKEN" | gh auth login --with-token
70+
fi
6971

7072
gh release create "$TAG" \
7173
--title "$TAG release" \

bin/update-build-info.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import child_process from "child_process";
2+
import fs from "fs";
3+
4+
function getBuildDate() {
5+
const now = new Date();
6+
now.setMilliseconds(0);
7+
return now
8+
.toISOString()
9+
.replace(".000", "");
10+
}
11+
12+
function getGitRevision() {
13+
return child_process.execSync('git log -1 --format="%H"')
14+
.toString("utf-8")
15+
.trimEnd();
16+
}
17+
18+
const output = `\
19+
export = {
20+
buildDate: "${getBuildDate()}",
21+
buildRevision: "${getGitRevision()}"
22+
};
23+
`;
24+
25+
fs.writeFileSync("src/services/build.ts", output);

0 commit comments

Comments
 (0)