Skip to content

Build your personal knowledge base with Trilium Notes

Update build-server.sh and GitHub Actions to build ARM server

Jon Fuller7e30ab2e06fa
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 659040904d..0b20762dea 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -72,9 +72,18 @@ jobs:
with:
name: TriliumNextNotes ${{ matrix.os.name }} ${{ matrix.arch }}.${{matrix.os.extension}}
path: upload/*.${{ matrix.os.extension }}
- build_linux_server-x64:
- name: Build Linux Server x86_64
- runs-on: ubuntu-latest
+ build_linux_server:
+ name: Build Linux Server
+ strategy:
+ fail-fast: false
+ matrix:
+ arch: [x64, arm64]
+ include:
+ - arch: x64
+ runs-on: ubuntu-latest
+ - arch: arm64
+ runs-on: ubuntu-24.04-arm
+ runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- name: Set up node & dependencies
@@ -84,17 +93,18 @@ jobs:
cache: "npm"
- name: Install dependencies
run: npm ci
- - name: Run Linux server build (x86_64)
+ - name: Run Linux server build
+ env:
+ MATRIX_ARCH: ${{ matrix.arch }}
run: |
npm run update-build-info
./bin/build-server.sh
- name: Prepare artifacts
- if: runner.os != 'windows'
run: |
mkdir -p upload
file=$(find dist -name '*.tar.xz' -print -quit)
- cp "$file" "upload/TriliumNextNotes-linux-x64-${{ github.ref_name }}.tar.xz"
+ cp "$file" "upload/TriliumNextNotes-linux-${{ matrix.arch }}-${{ github.ref_name }}.tar.xz"
- uses: actions/upload-artifact@v4
with:
- name: TriliumNextNotes linux server x64
- path: upload/TriliumNextNotes-linux-x64-${{ github.ref_name }}.tar.xz
+ name: TriliumNextNotes linux server ${{ matrix.arch }}
+ path: upload/TriliumNextNotes-linux-${{ matrix.arch }}-${{ github.ref_name }}.tar.xz
diff --git a/bin/build-server.sh b/bin/build-server.sh
index 64e7984221..47bfe9397c 100755
--- a/bin/build-server.sh
+++ b/bin/build-server.sh
@@ -2,21 +2,57 @@
set -e # Fail on any command error
-PKG_DIR=dist/trilium-linux-x64-server
+# Debug output
+echo "Matrix Arch: $MATRIX_ARCH"
+
+# Detect architecture from matrix input, fallback to system architecture
+if [ -n "$MATRIX_ARCH" ]; then
+ ARCH=$MATRIX_ARCH
+else
+ ARCH=$(uname -m)
+ # Convert system architecture to our naming convention
+ case $ARCH in
+ x86_64) ARCH="x64" ;;
+ aarch64) ARCH="arm64" ;;
+ esac
+fi
+
+# Debug output
+echo "Selected Arch: $ARCH"
+
+# Set Node.js version and architecture-specific filename
NODE_VERSION=20.15.1
+NODE_ARCH=$ARCH
+
+# Debug output
+echo "Node arch: $NODE_ARCH"
+
+# Special case for x64 in Node.js downloads
+if [ "$NODE_ARCH" = "x64" ]; then
+ NODE_FILENAME="x64"
+elif [ "$NODE_ARCH" = "arm64" ]; then
+ NODE_FILENAME="arm64"
+fi
+
+# Debug output
+echo "Node filename: $NODE_FILENAME"
+
+PKG_DIR=dist/trilium-linux-${ARCH}-server
+echo "Package directory: $PKG_DIR"
if [ "$1" != "DONTCOPY" ]
then
- ./bin/copy-trilium.sh $PKG_DIR
+ # Need to modify copy-trilium.sh to accept the target directory
+ ./bin/copy-trilium.sh "$PKG_DIR"
fi
cd dist
-wget https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz
-tar xfJ node-v${NODE_VERSION}-linux-x64.tar.xz
-rm node-v${NODE_VERSION}-linux-x64.tar.xz
+wget https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_FILENAME}.tar.xz
+tar xfJ node-v${NODE_VERSION}-linux-${NODE_FILENAME}.tar.xz
+rm node-v${NODE_VERSION}-linux-${NODE_FILENAME}.tar.xz
cd ..
-mv dist/node-v${NODE_VERSION}-linux-x64 $PKG_DIR/node
+mv dist/node-v${NODE_VERSION}-linux-${NODE_FILENAME} $PKG_DIR/node
rm -r $PKG_DIR/node/lib/node_modules/npm
rm -r $PKG_DIR/node/include/node
@@ -37,4 +73,4 @@ VERSION=`jq -r ".version" package.json`
cd dist
-tar cJf trilium-linux-x64-server-${VERSION}.tar.xz trilium-linux-x64-server
+tar cJf trilium-linux-${ARCH}-server-${VERSION}.tar.xz trilium-linux-${ARCH}-server