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

This commit is contained in:
Jon Fuller 2025-01-17 11:52:45 -08:00 committed by perf3ct
parent dd3397bcbb
commit 7e30ab2e06
No known key found for this signature in database
GPG Key ID: 569C4EEC436F5232
2 changed files with 61 additions and 15 deletions

View File

@ -72,9 +72,18 @@ jobs:
with: with:
name: TriliumNextNotes ${{ matrix.os.name }} ${{ matrix.arch }}.${{matrix.os.extension}} name: TriliumNextNotes ${{ matrix.os.name }} ${{ matrix.arch }}.${{matrix.os.extension}}
path: upload/*.${{ matrix.os.extension }} path: upload/*.${{ matrix.os.extension }}
build_linux_server-x64: build_linux_server:
name: Build Linux Server x86_64 name: Build Linux Server
runs-on: ubuntu-latest 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: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up node & dependencies - name: Set up node & dependencies
@ -84,17 +93,18 @@ jobs:
cache: "npm" cache: "npm"
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Run Linux server build (x86_64) - name: Run Linux server build
env:
MATRIX_ARCH: ${{ matrix.arch }}
run: | run: |
npm run update-build-info npm run update-build-info
./bin/build-server.sh ./bin/build-server.sh
- name: Prepare artifacts - name: Prepare artifacts
if: runner.os != 'windows'
run: | run: |
mkdir -p upload mkdir -p upload
file=$(find dist -name '*.tar.xz' -print -quit) 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 - uses: actions/upload-artifact@v4
with: with:
name: TriliumNextNotes linux server x64 name: TriliumNextNotes linux server ${{ matrix.arch }}
path: upload/TriliumNextNotes-linux-x64-${{ github.ref_name }}.tar.xz path: upload/TriliumNextNotes-linux-${{ matrix.arch }}-${{ github.ref_name }}.tar.xz

View File

@ -2,21 +2,57 @@
set -e # Fail on any command error 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_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" ] if [ "$1" != "DONTCOPY" ]
then 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 fi
cd dist cd dist
wget https://nodejs.org/dist/v${NODE_VERSION}/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-x64.tar.xz tar xfJ node-v${NODE_VERSION}-linux-${NODE_FILENAME}.tar.xz
rm node-v${NODE_VERSION}-linux-x64.tar.xz rm node-v${NODE_VERSION}-linux-${NODE_FILENAME}.tar.xz
cd .. 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/lib/node_modules/npm
rm -r $PKG_DIR/node/include/node rm -r $PKG_DIR/node/include/node
@ -37,4 +73,4 @@ VERSION=`jq -r ".version" package.json`
cd dist 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