Skip to content

Set up NX-based monorepo #1773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 397 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
397 commits
Select commit Hold shift + click to select a range
5564c76
chore(monorepo): sync package lock
eliandoran Apr 21, 2025
3eba61d
chore(monorepo): remove no longer relevant script
eliandoran Apr 21, 2025
df7e7b4
chore(monorepo): missing vitest dependency
eliandoran Apr 21, 2025
b750920
chore(monorepo/edit-docs): port files
eliandoran Apr 21, 2025
e49d248
chore(monorepo/dump-db): move to apps
eliandoran Apr 21, 2025
a068f75
chore(monorepo/edit-docs): fix module issue & add entry point
eliandoran Apr 22, 2025
fcd6a31
chore(monorepo/server): move Docker files
eliandoran Apr 22, 2025
2e200ea
Merge remote-tracking branch 'origin/develop' into feature/client_ser…
eliandoran Apr 22, 2025
62dbcc0
chore(nx): move all monorepo-style in subfolder for processing
eliandoran Apr 22, 2025
4f70084
chore(nx): start off with a blank package.json
eliandoran Apr 22, 2025
a56b3c8
chore(nx): move .vscode extensions to old
eliandoran Apr 22, 2025
57ecf72
chore(nx): initialize as empty project
eliandoran Apr 22, 2025
84b6764
chore(nx): initialize empty commons project
eliandoran Apr 22, 2025
41cf38a
chore(nx): prepare commons
eliandoran Apr 22, 2025
a10a4ba
chore(nx): prepare turndown-plugin-gfm
eliandoran Apr 22, 2025
9c0d422
chore(nx): create empty project for server
eliandoran Apr 22, 2025
b2af043
chore(nx/server): move source code
eliandoran Apr 22, 2025
e76f47e
chore(nx/server): switch to module
eliandoran Apr 22, 2025
1cbf574
chore(nx): remove unnecessary files
eliandoran Apr 22, 2025
9dafaba
chore(nx/server): manage dependencies
eliandoran Apr 22, 2025
462ed3c
chore(nx/server): remove empty file
eliandoran Apr 22, 2025
1c63fb7
chore(monorepo/server): configure to work with top-level await
eliandoran Apr 22, 2025
e655963
chore(monorepo): remove dist
eliandoran Apr 22, 2025
6e35806
chore(monorepo/server): fix build errors due to wrong imports
eliandoran Apr 22, 2025
6543d6c
chore(monorepo/server): remove top-level await completely
eliandoran Apr 22, 2025
2aad162
chore(monorepo/server): fix db asset path
eliandoran Apr 22, 2025
40fec89
chore(nx/turndown-plugin): fix compilation
eliandoran Apr 22, 2025
b27ff1d
chore(nx/commons): fix compilation
eliandoran Apr 22, 2025
2148714
chore(nx/server): add dependency to electron
eliandoran Apr 22, 2025
d5e1c5c
chore(nx/server): fix favicon
eliandoran Apr 22, 2025
e817a55
chore(nx/server): fix api_docs_js_1.default.register is not a function
eliandoran Apr 22, 2025
23572bd
chore(monorepo/client): create empty project
eliandoran Apr 22, 2025
9afe2ef
chore(monorepo/client): move client source files
eliandoran Apr 22, 2025
70466dd
chore(monorepo/client): sync settings
eliandoran Apr 22, 2025
fa48e59
chore(monorepo/client): set up dependencies
eliandoran Apr 22, 2025
eb6d802
chore(monorepo/client): set up stylesheets
eliandoran Apr 22, 2025
aeeedea
chore(monorepo/client): reintroduce script loader
eliandoran Apr 22, 2025
f2ade4e
chore(nx/client): bypass module errors due to electron dependency
eliandoran Apr 23, 2025
bcc908a
chore(nx/client): fix asset error
eliandoran Apr 23, 2025
23bfda0
chore(nx/client): fix dependency to commons
eliandoran Apr 23, 2025
f89eb8c
chore(nx/client): warning about util module
eliandoran Apr 23, 2025
c3a0c54
chore(nx/client): set up entrypoints
eliandoran Apr 23, 2025
eb67fe5
chore(nx/client): set up environment variables for serve
eliandoran Apr 23, 2025
4e8ab98
chore(nx/client): missing config-sample
eliandoran Apr 23, 2025
5308a08
chore(nx/client): set up proxy to client
eliandoran Apr 23, 2025
659ccd8
refactor(nx/client): set up proxy to client
eliandoran Apr 23, 2025
0d4de2a
refactor(nx/client): add types for http proxy
eliandoran Apr 23, 2025
b2d051e
refactor(nx/server): fix proxying of stylesheets
eliandoran Apr 23, 2025
824d9e8
refactor(nx/client): fix CSS comment breaking build
eliandoran Apr 23, 2025
b213f99
fix(nx/client): missing runtime chunk
eliandoran Apr 23, 2025
44b778f
fix(nx/client): proxying of libraries
eliandoran Apr 23, 2025
43a44bf
chore(nx/client): supress bootstrap warnings
eliandoran Apr 23, 2025
9d284a5
chore(nx/client): revert change to i18n debug
eliandoran Apr 23, 2025
ca309f3
chore(nx/client): get rid of warnings overlay
eliandoran Apr 23, 2025
492e953
chore(nx/desktop): start off with empty project
eliandoran Apr 23, 2025
15fbe41
chore(nx/desktop): switch to webpack-based build
eliandoran Apr 23, 2025
7f96514
chore(nx/desktop): set up source code via webpack
eliandoran Apr 23, 2025
470cd7f
chore(nx/desktop): bundle server
eliandoran Apr 23, 2025
4e6047f
chore(nx/desktop): copy .node file for better-sqlite3
eliandoran Apr 23, 2025
5d02afe
chore(nx/desktop): implement electron-rebuild
eliandoran Apr 23, 2025
5dd2b21
fix(nx/desktop): backend not imported well
eliandoran Apr 23, 2025
5389b8b
chore(monorepo): switch to pnpm
eliandoran Apr 23, 2025
42c5ef2
chore(monorepo): get electron to start
eliandoran Apr 23, 2025
de94457
chore(monorepo/server): set up copy of bettersqlite
eliandoran Apr 24, 2025
c8f0fac
fix(monorepo/client): errors after pnpm
eliandoran Apr 24, 2025
c79e3f5
fix(monorepo/server): asset path
eliandoran Apr 24, 2025
28ce71a
fix(monorepo/server): get translations to work
eliandoran Apr 24, 2025
d201087
feat(nx/server): copy client into server
eliandoran Apr 24, 2025
5911eaf
fix(nx/server): get images to work in dev mode
eliandoran Apr 24, 2025
11955ae
fix(nx/server): serve most assets for dist
eliandoran Apr 24, 2025
b3754f4
chore(nx): sync tsconfig
eliandoran Apr 24, 2025
a84744d
chore(nx): trigger client build when server is built
eliandoran Apr 24, 2025
13d9cb4
fix(nx/server): flaky run due to missing debug dependency
eliandoran Apr 24, 2025
258fe2e
fix(nx/server): missing images in dist
eliandoran Apr 24, 2025
ab2f0ee
fix(nx/server): disable chunking for prod
eliandoran Apr 24, 2025
6cd6043
chore(nx): update scripts
eliandoran Apr 24, 2025
d6f4b44
chore(nx): change data dir for server:start-prod
eliandoran Apr 24, 2025
494ee47
fix(nx/server): access to assets in prod
eliandoran Apr 24, 2025
cd14d8e
fix(nx/server): access to highlight.js styles
eliandoran Apr 24, 2025
f602a9f
chore(nx/desktop): run scripts
eliandoran Apr 24, 2025
6aef6df
chore(nx/desktop): copy client
eliandoran Apr 24, 2025
e3cff46
chore(nx/desktop): remove unnecessary dependencies & adapt scripts
eliandoran Apr 24, 2025
3ce4aa1
fix(nx/desktop): ejs missing
eliandoran Apr 24, 2025
e6f9d40
fix(nx/desktop): use proper approach for ejs missing
eliandoran Apr 24, 2025
aa68c70
chore(nx/server): remove logging
eliandoran Apr 24, 2025
aab545b
chore(nx/server): set proper resource dir when run from dist
eliandoran Apr 24, 2025
ec8740b
fix(nx/desktop): get dist to start by simplifying module import
eliandoran Apr 24, 2025
e819fac
fix(monorepo/server): missing dependencies to bettersqlite
eliandoran Apr 24, 2025
37a7cb6
chore(monorepo/desktop): improve run script
eliandoran Apr 24, 2025
e8095e8
chore(vscode): add NX console to recommended extensions
eliandoran Apr 24, 2025
7935b25
fix(monorepo/desktop): remote not working
eliandoran Apr 24, 2025
be79eb4
fix(monorepo/{client,server}): loading of fonts
eliandoran Apr 24, 2025
2681584
chore(monorepo/server): type error
eliandoran Apr 24, 2025
7adafdf
fix(monorepo/electron): tray icon
eliandoran Apr 24, 2025
12581a5
chore(monorepo/server): native dependencies
eliandoran Apr 24, 2025
12977f1
chore(nx): add server:start
eliandoran Apr 25, 2025
0e8b1f3
chore(nx/docker): basic integration
eliandoran Apr 25, 2025
b44876e
chore(nx/server): resource dir
eliandoran Apr 25, 2025
cc7d6de
chore(nx/docker): add entrypoint for starting docker
eliandoran Apr 25, 2025
422c169
chore(vscode): add docker to recommendations
eliandoran Apr 25, 2025
9ef24ef
chore(vscode): add yaml to recommendations
eliandoran Apr 25, 2025
a808f06
fix(nx/docker): wrong native for better-sqlite3
eliandoran Apr 25, 2025
b9a16c6
fix(nx/docker): wrong paths at app level
eliandoran Apr 25, 2025
9fc06c4
refactor(nx/docker): more cacheable installation
eliandoran Apr 25, 2025
73bfff3
fix(nx/docker): access to ETAPI
eliandoran Apr 25, 2025
76e43f3
chore(nx/server): sync dependencies
eliandoran Apr 25, 2025
db71c18
feat(nx/docker): bind port
eliandoran Apr 25, 2025
b63a5d3
fix(nx/docker): serving most assets
eliandoran Apr 25, 2025
d8ee579
fix(nx/docker): icon, manifest & robots.txt
eliandoran Apr 25, 2025
69f8540
fix(nx/docker): client-side translations
eliandoran Apr 25, 2025
8f26d4c
fix(nx/docker): LLM prompts not accessible
eliandoran Apr 25, 2025
506935b
fix(nx/forge): get forge command to execute
eliandoran Apr 25, 2025
4257da6
fix(nx/forge): get forge building to actually run
eliandoran Apr 25, 2025
457bf2b
chore(nx/server): get electron-forge up to "Finalizing package"
eliandoran Apr 25, 2025
997ed22
chore(nx/forge): templates not working
eliandoran Apr 25, 2025
b6b9ca1
chore(nx/forge): add strange workaround to solve node modules
eliandoran Apr 25, 2025
de4fc47
fix(nx/forge): setup icon
eliandoran Apr 25, 2025
adb6a7c
fix(nx/forge): nuspec failing due to missing meta
eliandoran Apr 25, 2025
6db093c
chore(nx): update gitignore
eliandoran Apr 25, 2025
dffbbee
chore(nx/forge): add package command
eliandoran Apr 25, 2025
aa388e0
chore(nx/forge): ignore a few unnecessary files
eliandoran Apr 25, 2025
e266b50
chore(nx/forge): fix prebuilds and build from dist
eliandoran Apr 26, 2025
ebb78e4
fix(nx/forge): serve assets from ASAR
eliandoran Apr 26, 2025
3122889
feat(nx/forge): reduce size of better-sqlite3
eliandoran Apr 26, 2025
82e98e5
fix(nx/forge): electron-forge:make not working
eliandoran Apr 26, 2025
b34d823
fix(nx/forge): app icons missing
eliandoran Apr 26, 2025
345e5cf
fix(nx/forge): path to electron-forge binaries
eliandoran Apr 26, 2025
379d482
fix(nx/server): incorrect normalize.css
eliandoran Apr 26, 2025
7a2b481
chore(nx/desktop): dedicated port
eliandoran Apr 26, 2025
880958e
fix(nx/forge): missing jquery-hotkeys
eliandoran Apr 26, 2025
bfb2ca5
fix(nx/forge): missing highlightjs
eliandoran Apr 26, 2025
81df2e7
refactor(nx/forge): typo
eliandoran Apr 26, 2025
251660e
chore(nx): restructure dependencies
eliandoran Apr 26, 2025
3890eff
chore(nx/client): reintegrate tests
eliandoran Apr 26, 2025
273af2d
chore(nx/client): set up pnpm for release
eliandoran Apr 26, 2025
76a6dec
chore(nx/ci): set up pnpm
eliandoran Apr 27, 2025
9f5d233
chore(nx/ci): set up pnpm install
eliandoran Apr 27, 2025
17e5a6e
chore(nx/ci):: workspace scripts
eliandoran Apr 27, 2025
5560691
chore(nx/ci):: run electron-forge:make
eliandoran Apr 27, 2025
8f5dc1a
chore(nx/ci):: fix glob
eliandoran Apr 27, 2025
c1a7b36
chore(nx/ci): fix some dependencies not being triggered
eliandoran Apr 27, 2025
edffe3a
chore(nx/ci): set client as implicit dependency for server
eliandoran Apr 27, 2025
54202c5
chore(nx/forge): try to fix .deb building
eliandoran Apr 27, 2025
d4b5f95
chore(nx/ci): fix wrong cache
eliandoran Apr 27, 2025
8377a80
chore(nx/forge): try setting more options to fix deb build
eliandoran Apr 27, 2025
1a92e48
chore(nx/forge): try setting more options to fix rpm build
eliandoran Apr 27, 2025
3bdd13f
chore(nx/forge): work on server packaging
eliandoran Apr 27, 2025
0784a71
chore(nx/forge): fix package not building server
eliandoran Apr 27, 2025
bf98d92
chore(nx/server): fix upload path
eliandoran Apr 27, 2025
dfdc93f
chore(nx/forge): missing license meta
eliandoran Apr 27, 2025
575f38e
chore(nx/forge): add some debug logging for env
eliandoran Apr 27, 2025
6e1b8ba
fix(nx/forge): missing apple id for signing
eliandoran Apr 27, 2025
543d615
feat(forge): bypass macos signing when building locally
eliandoran Apr 27, 2025
0080684
Revert "chore(nx/forge): add some debug logging for env"
eliandoran Apr 27, 2025
7cc2e04
fix(forge/macos): approve fs-xattr & macos-alias
eliandoran Apr 27, 2025
8c685e6
chore(nx/forge): try to force rebuild packages
eliandoran Apr 27, 2025
ceb4f20
chore(nx/forge): add debug logging for electron-rebuild
eliandoran Apr 27, 2025
fec9ca6
fix(nx/forge): rebuild not working due to ignore logic
eliandoran Apr 27, 2025
dbad4fc
chore(nx/forge): try a method to avoid missing prebuilds
eliandoran Apr 27, 2025
eab98e2
chore(nx/ci): display output of signing
eliandoran Apr 27, 2025
bac0503
chore(nx/ci): add debug logs for signing
eliandoran Apr 27, 2025
b5eedf2
chore(nx/server): introduce tests
eliandoran Apr 28, 2025
fb6c8e0
fix(nx/turndown-plugin-gfm): wrong entrypoint for vite
eliandoran Apr 28, 2025
0fa6524
chore(test/server): add back integration test database
eliandoran Apr 28, 2025
a8b8817
chore(nx/test): set up global test script
eliandoran Apr 28, 2025
8773c32
Merge remote-tracking branch 'origin/develop' into feature/nx_monorepo
eliandoran Apr 28, 2025
f60bc89
refactor(client): unused imports
eliandoran Apr 28, 2025
0bef31c
refactor(server): migration DBs
eliandoran Apr 28, 2025
729ea1d
refactor(test/server): database
eliandoran Apr 28, 2025
d74b8e6
fix(server): migration not working
eliandoran Apr 28, 2025
05a61eb
fix(server): imports in migration not working
eliandoran Apr 28, 2025
5029bfe
chore(nx): merge vitest configs
eliandoran Apr 28, 2025
f6dc912
fix(test): i18n tests
eliandoran Apr 28, 2025
4dafa56
fix(test): url import not found
eliandoran Apr 28, 2025
59663ed
fix(test/server): supertest-based tests no longer working
eliandoran Apr 28, 2025
cc07144
chore(test/server): wrong test config
eliandoran Apr 28, 2025
6e4698c
chore(test/server): fix some initialization errors
eliandoran Apr 28, 2025
43876de
chore(test/server): always initialize translations
eliandoran Apr 28, 2025
6db6bec
chore(test/server): fix isWindows() read before defined
eliandoran Apr 28, 2025
bb278d4
chore(test/server): fix some mocks no longer working
eliandoran Apr 28, 2025
7671143
chore(test/server): fix date notes test
eliandoran Apr 28, 2025
317d95f
chore(nx/desktop): set up serve
eliandoran Apr 28, 2025
2ccbc10
chore(nx/forge): add error logging for windows signing
eliandoran Apr 28, 2025
d6c67b0
chore(nx/forge): report error when signing
eliandoran Apr 28, 2025
31aff8a
chore(nx/forge): try to use real path for signing
eliandoran Apr 28, 2025
9bf1e7b
chore(nx/forge): display content for debugging
eliandoran Apr 28, 2025
ea4f5f1
chore(nx/forge): try to copy the file instead
eliandoran Apr 28, 2025
4976033
chore(nx/forge): log architecture
eliandoran Apr 28, 2025
6aaacd6
fix(test/server): one more failing test
eliandoran Apr 28, 2025
546bb52
chore(nx/forge): print signing logs on error
eliandoran Apr 28, 2025
e186131
chore(nx/server): set up e2e
eliandoran Apr 28, 2025
b9af4e4
chore(nx): remove unnecessary git files
eliandoran Apr 28, 2025
64f3154
chore(turndown-plugin-gfm): integrate tests
eliandoran Apr 28, 2025
fdcdc41
chore(nx): clean up package JSON
eliandoran Apr 28, 2025
9d5fbc6
chore(nx/dump-db): integrate into monorepo
eliandoran Apr 28, 2025
ee42801
chore(nx/desktop): add entry point for NixOS
eliandoran Apr 29, 2025
e000207
chore(deps): update lock file
eliandoran Apr 29, 2025
d31fa7a
chore(nx/e2e): use generated playwright workflow
eliandoran Apr 29, 2025
32bc24b
chore(test/client): solve dependency error due to CJS
eliandoran Apr 29, 2025
50d1d4f
chore(test/client): wrong path to docs
eliandoran Apr 29, 2025
2c2953c
test(turndown-plugin-gfm): wrong test cases for strikethrough
eliandoran Apr 29, 2025
054c024
test(turndown-plugin-gfm): fix tests for table
eliandoran Apr 29, 2025
7e2d638
chore(nx/ci): fix "Build Docker image" step
eliandoran Apr 29, 2025
6aaa25e
chore(nx/ci): add concurrency to nightly builds
eliandoran Apr 29, 2025
37708c8
fix(docker): missing file
eliandoran Apr 29, 2025
d812471
chore(ci/docker): trigger dist build
eliandoran Apr 29, 2025
0039661
chore(nx): integrate edit-docs
eliandoran Apr 29, 2025
83385a2
chore(edit-docs): add serve script
eliandoran Apr 29, 2025
965d64f
chore(ci/playwright): set up pnpm
eliandoran Apr 29, 2025
a6f401b
chore(ci/playwright): change playwright targets
eliandoran Apr 29, 2025
6da8a89
chore(docker): use paths relative to project
eliandoran Apr 29, 2025
2920838
chore(docker): fix docker-build script
eliandoran Apr 29, 2025
fada210
chore(ci): adapt more docker steps
eliandoran Apr 29, 2025
dd99f6c
chore(docker): integrate debian-based container
eliandoran Apr 29, 2025
419eb0b
chore(ci/docker): fix "no such file or directory"
eliandoran Apr 30, 2025
466e7e2
chore(ci/docker): fix entrypoint
eliandoran Apr 30, 2025
78c88d7
chore(docker): fix missing bindings after refactoring
eliandoran Apr 30, 2025
614958f
chore(docker): reintroduce healthchecks
eliandoran Apr 30, 2025
57c6dd2
chore(forge): gather files to be signed for analysis
eliandoran Apr 30, 2025
52d6efe
chore(edit-docs): get it to start partially
eliandoran Apr 30, 2025
e314372
chore(edidt-docs): fix entrypoint partially
eliandoran Apr 30, 2025
87d7dc8
chore(nx): add name to each project
eliandoran Apr 30, 2025
4689ef2
Merge remote-tracking branch 'origin/develop' into feature/nx_monorepo
eliandoran Apr 30, 2025
6e29b05
chore(nx/desktop): rename scripts to avoid collision with server
eliandoran May 1, 2025
a0c1bdd
chore(nx/desktop): fix electron-rebuild on fresh install
eliandoran May 1, 2025
b64521d
chore(nx/desktop): use custom electron-rebuild script
eliandoran May 1, 2025
a083418
chore(server-e2e): allow starting via VS Code
eliandoran May 1, 2025
d690344
chore(server-e2e): URL causing cookies to not work properly
eliandoran May 1, 2025
8667ee3
fix(server): in-app documentation for prod
eliandoran May 1, 2025
3119169
Merge remote-tracking branch 'origin/develop' into feature/nx_monorepo
eliandoran May 1, 2025
42ea41b
chore(nx): fix "Cannot read properties of undefined"
eliandoran May 1, 2025
783c99a
test(client): wrong path to help button
eliandoran May 1, 2025
1d12891
chore(types): fix errors due to verbatim module syntax
eliandoran May 1, 2025
8d705f1
chore(e2e): remove usage of path which caused some issues
eliandoran May 1, 2025
389bb79
fix(edit-docs): electron not being able to start
eliandoran May 1, 2025
b72e733
fix(edit-docs): missing assets
eliandoran May 1, 2025
385182c
fix(edit-docs): get Electron to actually start
eliandoran May 1, 2025
9b2accb
chore(sign): log architecture of sign tool
eliandoran May 1, 2025
8f46116
chore(sign): stop terminating signing if it fails
eliandoran May 1, 2025
c4b89f7
Merge remote-tracking branch 'origin/develop' into feature/nx_monorepo
eliandoran May 1, 2025
04ed9c0
chore(sign): clean up
eliandoran May 1, 2025
d48face
Merge branch 'feature/nx_monorepo' of https://github.com/TriliumNext/…
eliandoran May 1, 2025
d388cfa
chore(vs-code): extension recommandations
eliandoran May 1, 2025
1f9ddce
chore(sign): fix import error
eliandoran May 1, 2025
5596fa5
chore(sign): fix another import error
eliandoran May 1, 2025
1b2d769
chore(vs-code): i18n integration
eliandoran May 1, 2025
18fff28
chore(monorepo): integrate some more files
eliandoran May 1, 2025
ebab12d
chore(sign): change log format
eliandoran May 1, 2025
de2de04
chore(sign): use sign code known to work
eliandoran May 1, 2025
762da51
chore(monorepo): use hoisted pattern as it might help signing
eliandoran May 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 4 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package-lock.json linguist-generated=true
**/package-lock.json linguist-generated=true
src/public/app/doc_notes/en/User[[:space:]]Guide/** linguist-generated=true
src/public/app/doc_notes/en/User[[:space:]]Guide/**/*.md eol=lf
apps/server/src/assets/doc_notes/en/User[[:space:]]Guide/** linguist-generated=true

docs/**/*.md eol=lf

demo/**/*.html eol=lf
demo/**/*.json eol=lf
Expand All @@ -10,4 +11,4 @@ demo/**/*.txt eol=lf
demo/**/*.js eol=lf
demo/**/*.css eol=lf

libraries/** linguist-vendored
apps/client/src/libraries/** linguist-vendored
291 changes: 143 additions & 148 deletions .github/actions/build-electron/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,152 +18,147 @@ inputs:
runs:
using: composite
steps:
# Certificate setup
- name: Import Apple certificates
if: inputs.os == 'macos'
uses: apple-actions/import-codesign-certs@v5
with:
p12-file-base64: ${{ env.APPLE_APP_CERTIFICATE_BASE64 }}
p12-password: ${{ env.APPLE_APP_CERTIFICATE_PASSWORD }}
keychain: build-app-${{ github.run_id }}
keychain-password: ${{ github.run_id }}

- name: Install Installer certificate
if: inputs.os == 'macos'
uses: apple-actions/import-codesign-certs@v5
with:
p12-file-base64: ${{ env.APPLE_INSTALLER_CERTIFICATE_BASE64 }}
p12-password: ${{ env.APPLE_INSTALLER_CERTIFICATE_PASSWORD }}
keychain: build-installer-${{ github.run_id }}
keychain-password: ${{ github.run_id }}

- name: Verify certificates
if: inputs.os == 'macos'
shell: ${{ inputs.shell }}
run: |
echo "Available signing identities in app keychain:"
security find-identity -v -p codesigning build-app-${{ github.run_id }}.keychain

echo "Available signing identities in installer keychain:"
security find-identity -v -p codesigning build-installer-${{ github.run_id }}.keychain

# Make the keychains searchable
security list-keychains -d user -s build-app-${{ github.run_id }}.keychain build-installer-${{ github.run_id }}.keychain $(security list-keychains -d user | tr -d '"')
security default-keychain -s build-app-${{ github.run_id }}.keychain
security unlock-keychain -p ${{ github.run_id }} build-app-${{ github.run_id }}.keychain
security unlock-keychain -p ${{ github.run_id }} build-installer-${{ github.run_id }}.keychain
security set-keychain-settings -t 3600 -l build-app-${{ github.run_id }}.keychain
security set-keychain-settings -t 3600 -l build-installer-${{ github.run_id }}.keychain

- name: Set up Python and other macOS dependencies
if: ${{ inputs.os == 'macos' }}
shell: ${{ inputs.shell }}
run: |
brew install python-setuptools
brew install create-dmg

- name: Install dependencies for RPM and Flatpak package building
if: ${{ inputs.os == 'linux' }}
shell: ${{ inputs.shell }}
run: |
sudo apt-get update && sudo apt-get install rpm flatpak-builder elfutils
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
FLATPAK_ARCH=$(if [[ ${{ inputs.arch }} = 'arm64' ]]; then echo 'aarch64'; else echo 'x86_64'; fi)
FLATPAK_VERSION='24.08'
flatpak install --user --no-deps --arch $FLATPAK_ARCH --assumeyes runtime/org.freedesktop.Platform/$FLATPAK_ARCH/$FLATPAK_VERSION runtime/org.freedesktop.Sdk/$FLATPAK_ARCH/$FLATPAK_VERSION org.electronjs.Electron2.BaseApp/$FLATPAK_ARCH/$FLATPAK_VERSION

# Build setup
- name: Install dependencies
shell: ${{ inputs.shell }}
run: npm ci

- name: Update build info
shell: ${{ inputs.shell }}
run: npm run chore:update-build-info

# Critical debugging configuration
- name: Run electron-forge build with enhanced logging
shell: ${{ inputs.shell }}
env:
# Pass through required environment variables for signing and notarization
APPLE_TEAM_ID: ${{ env.APPLE_TEAM_ID }}
APPLE_ID: ${{ env.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ env.APPLE_ID_PASSWORD }}
WINDOWS_SIGN_EXECUTABLE: ${{ env.WINDOWS_SIGN_EXECUTABLE }}
TRILIUM_ARTIFACT_NAME_HINT: TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}
run: npm run electron-forge:make -- --arch=${{ inputs.arch }} --platform=${{ inputs.forge_platform }}

# Add DMG signing step
- name: Sign DMG
if: inputs.os == 'macos'
shell: ${{ inputs.shell }}
run: |
echo "Signing DMG file..."
dmg_file=$(find ./dist -name "*.dmg" -print -quit)
if [ -n "$dmg_file" ]; then
echo "Found DMG: $dmg_file"
# Get the first valid signing identity from the keychain
SIGNING_IDENTITY=$(security find-identity -v -p codesigning build-app-${{ github.run_id }}.keychain | grep "Developer ID Application" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$SIGNING_IDENTITY" ]; then
echo "Error: No valid Developer ID Application certificate found in keychain"
exit 1
fi
echo "Using signing identity: $SIGNING_IDENTITY"
# Sign the DMG
codesign --force --sign "$SIGNING_IDENTITY" --options runtime --timestamp "$dmg_file"
# Notarize the DMG
xcrun notarytool submit "$dmg_file" --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$APPLE_TEAM_ID" --wait
# Staple the notarization ticket
xcrun stapler staple "$dmg_file"
else
echo "No DMG found to sign"
fi

- name: Verify code signing
if: inputs.os == 'macos'
shell: ${{ inputs.shell }}
run: |
echo "Verifying code signing for all artifacts..."

# First check the .app bundle
echo "Looking for .app bundle..."
app_bundle=$(find ./dist -name "*.app" -print -quit)
if [ -n "$app_bundle" ]; then
echo "Found app bundle: $app_bundle"
echo "Verifying app bundle signing..."
codesign --verify --deep --strict --verbose=2 "$app_bundle"
echo "Displaying app bundle signing info..."
codesign --display --verbose=2 "$app_bundle"

echo "Checking entitlements..."
codesign --display --entitlements :- "$app_bundle"

echo "Checking notarization status..."
xcrun stapler validate "$app_bundle" || echo "Warning: App bundle not notarized yet"
else
echo "No .app bundle found to verify"
fi

# Then check DMG if it exists
echo "Looking for DMG..."
dmg_file=$(find ./dist -name "*.dmg" -print -quit)
if [ -n "$dmg_file" ]; then
echo "Found DMG: $dmg_file"
echo "Verifying DMG signing..."
codesign --verify --deep --strict --verbose=2 "$dmg_file"
echo "Displaying DMG signing info..."
codesign --display --verbose=2 "$dmg_file"

echo "Checking DMG notarization..."
xcrun stapler validate "$dmg_file" || echo "Warning: DMG not notarized yet"
else
echo "No DMG found to verify"
fi

# Finally check ZIP if it exists
echo "Looking for ZIP..."
zip_file=$(find ./dist -name "*.zip" -print -quit)
if [ -n "$zip_file" ]; then
echo "Found ZIP: $zip_file"
echo "Note: ZIP files are not code signed, but their contents should be"
# Certificate setup
- name: Import Apple certificates
if: inputs.os == 'macos'
uses: apple-actions/import-codesign-certs@v5
with:
p12-file-base64: ${{ env.APPLE_APP_CERTIFICATE_BASE64 }}
p12-password: ${{ env.APPLE_APP_CERTIFICATE_PASSWORD }}
keychain: build-app-${{ github.run_id }}
keychain-password: ${{ github.run_id }}

- name: Install Installer certificate
if: inputs.os == 'macos'
uses: apple-actions/import-codesign-certs@v5
with:
p12-file-base64: ${{ env.APPLE_INSTALLER_CERTIFICATE_BASE64 }}
p12-password: ${{ env.APPLE_INSTALLER_CERTIFICATE_PASSWORD }}
keychain: build-installer-${{ github.run_id }}
keychain-password: ${{ github.run_id }}

- name: Verify certificates
if: inputs.os == 'macos'
shell: ${{ inputs.shell }}
run: |
echo "Available signing identities in app keychain:"
security find-identity -v -p codesigning build-app-${{ github.run_id }}.keychain

echo "Available signing identities in installer keychain:"
security find-identity -v -p codesigning build-installer-${{ github.run_id }}.keychain

# Make the keychains searchable
security list-keychains -d user -s build-app-${{ github.run_id }}.keychain build-installer-${{ github.run_id }}.keychain $(security list-keychains -d user | tr -d '"')
security default-keychain -s build-app-${{ github.run_id }}.keychain
security unlock-keychain -p ${{ github.run_id }} build-app-${{ github.run_id }}.keychain
security unlock-keychain -p ${{ github.run_id }} build-installer-${{ github.run_id }}.keychain
security set-keychain-settings -t 3600 -l build-app-${{ github.run_id }}.keychain
security set-keychain-settings -t 3600 -l build-installer-${{ github.run_id }}.keychain

- name: Set up Python and other macOS dependencies
if: ${{ inputs.os == 'macos' }}
shell: ${{ inputs.shell }}
run: |
brew install python-setuptools
brew install create-dmg

- name: Install dependencies for RPM and Flatpak package building
if: ${{ inputs.os == 'linux' }}
shell: ${{ inputs.shell }}
run: |
sudo apt-get update && sudo apt-get install rpm flatpak-builder elfutils
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
FLATPAK_ARCH=$(if [[ ${{ inputs.arch }} = 'arm64' ]]; then echo 'aarch64'; else echo 'x86_64'; fi)
FLATPAK_VERSION='24.08'
flatpak install --user --no-deps --arch $FLATPAK_ARCH --assumeyes runtime/org.freedesktop.Platform/$FLATPAK_ARCH/$FLATPAK_VERSION runtime/org.freedesktop.Sdk/$FLATPAK_ARCH/$FLATPAK_VERSION org.electronjs.Electron2.BaseApp/$FLATPAK_ARCH/$FLATPAK_VERSION

- name: Update build info
shell: ${{ inputs.shell }}
run: npm run chore:update-build-info

# Critical debugging configuration
- name: Run electron-forge build with enhanced logging
shell: ${{ inputs.shell }}
env:
# Pass through required environment variables for signing and notarization
APPLE_TEAM_ID: ${{ env.APPLE_TEAM_ID }}
APPLE_ID: ${{ env.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ env.APPLE_ID_PASSWORD }}
WINDOWS_SIGN_EXECUTABLE: ${{ env.WINDOWS_SIGN_EXECUTABLE }}
TRILIUM_ARTIFACT_NAME_HINT: TriliumNextNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}
run: pnpm nx --project=desktop electron-forge:make -- --arch=${{ inputs.arch }} --platform=${{ inputs.forge_platform }}

# Add DMG signing step
- name: Sign DMG
if: inputs.os == 'macos'
shell: ${{ inputs.shell }}
run: |
echo "Signing DMG file..."
dmg_file=$(find ./apps/desktop/dist -name "*.dmg" -print -quit)
if [ -n "$dmg_file" ]; then
echo "Found DMG: $dmg_file"
# Get the first valid signing identity from the keychain
SIGNING_IDENTITY=$(security find-identity -v -p codesigning build-app-${{ github.run_id }}.keychain | grep "Developer ID Application" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$SIGNING_IDENTITY" ]; then
echo "Error: No valid Developer ID Application certificate found in keychain"
exit 1
fi
echo "Using signing identity: $SIGNING_IDENTITY"
# Sign the DMG
codesign --force --sign "$SIGNING_IDENTITY" --options runtime --timestamp "$dmg_file"
# Notarize the DMG
xcrun notarytool submit "$dmg_file" --apple-id "$APPLE_ID" --password "$APPLE_ID_PASSWORD" --team-id "$APPLE_TEAM_ID" --wait
# Staple the notarization ticket
xcrun stapler staple "$dmg_file"
else
echo "No DMG found to sign"
fi

- name: Verify code signing
if: inputs.os == 'macos'
shell: ${{ inputs.shell }}
run: |
echo "Verifying code signing for all artifacts..."

# First check the .app bundle
echo "Looking for .app bundle..."
app_bundle=$(find ./apps/desktop/dist -name "*.app" -print -quit)
if [ -n "$app_bundle" ]; then
echo "Found app bundle: $app_bundle"
echo "Verifying app bundle signing..."
codesign --verify --deep --strict --verbose=2 "$app_bundle"
echo "Displaying app bundle signing info..."
codesign --display --verbose=2 "$app_bundle"

echo "Checking entitlements..."
codesign --display --entitlements :- "$app_bundle"

echo "Checking notarization status..."
xcrun stapler validate "$app_bundle" || echo "Warning: App bundle not notarized yet"
else
echo "No .app bundle found to verify"
fi

# Then check DMG if it exists
echo "Looking for DMG..."
dmg_file=$(find ./apps/desktop/dist -name "*.dmg" -print -quit)
if [ -n "$dmg_file" ]; then
echo "Found DMG: $dmg_file"
echo "Verifying DMG signing..."
codesign --verify --deep --strict --verbose=2 "$dmg_file"
echo "Displaying DMG signing info..."
codesign --display --verbose=2 "$dmg_file"

echo "Checking DMG notarization..."
xcrun stapler validate "$dmg_file" || echo "Warning: DMG not notarized yet"
else
echo "No DMG found to verify"
fi

# Finally check ZIP if it exists
echo "Looking for ZIP..."
zip_file=$(find ./apps/desktop/dist -name "*.zip" -print -quit)
if [ -n "$zip_file" ]; then
echo "Found ZIP: $zip_file"
echo "Note: ZIP files are not code signed, but their contents should be"
fi
45 changes: 23 additions & 22 deletions .github/actions/build-server/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,26 @@ inputs:
runs:
using: composite
steps:
- name: Set up node & dependencies
uses: actions/setup-node@v4
with:
node-version: 22
cache: "npm"
- name: Install dependencies
shell: bash
run: npm ci
- name: Run Linux server build
env:
MATRIX_ARCH: ${{ inputs.arch }}
shell: bash
run: |
npm run chore:update-build-info
./bin/build-server.sh
- name: Prepare artifacts
shell: bash
run: |
mkdir -p upload
file=$(find dist -name '*.tar.xz' -print -quit)
name=${{ github.ref_name }}
cp "$file" "upload/TriliumNextNotes-Server-${name//\//-}-${{ inputs.os }}-${{ inputs.arch }}.tar.xz"
- uses: pnpm/action-setup@v4
- name: Set up node & dependencies
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile
- name: Run Linux server build
env:
MATRIX_ARCH: ${{ inputs.arch }}
shell: bash
run: |
pnpm run chore:update-build-info
pnpm nx --project=server package
- name: Prepare artifacts
shell: bash
run: |
mkdir -p upload
file=$(find ./apps/server/out -name '*.tar.xz' -print -quit)
name=${{ github.ref_name }}
cp "$file" "upload/TriliumNextNotes-Server-${name//\//-}-${{ inputs.os }}-${{ inputs.arch }}.tar.xz"
Loading
Loading