mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 21:19:01 +01:00 
			
		
		
		
	Merge pull request #979 from perfectra1n/develop
Update build-server.sh and GitHub Actions to build ARM server
This commit is contained in:
		
						commit
						423bea923c
					
				
							
								
								
									
										24
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							@ -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
 | 
			
		||||
  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
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user