Skip to content

Build your personal knowledge base with Trilium Notes

refactor(ci): deduplicate server build

Elian Doran6ae143cc38d7
diff --git a/.github/actions/build-server/action.yml b/.github/actions/build-server/action.yml
new file mode 100644
index 0000000000..6852220579
--- /dev/null
+++ b/.github/actions/build-server/action.yml
@@ -0,0 +1,25 @@
+inputs:
+ arch:
+ description: "The architecture to build for: x64, arm64"
+ required: true
+runs:
+ using: composite
+ steps:
+ - name: Set up node & dependencies
+ uses: actions/setup-node@v4
+ with:
+ node-version: 20
+ cache: "npm"
+ - name: Install dependencies
+ run: npm ci
+ - name: Run Linux server build
+ env:
+ MATRIX_ARCH: ${{ inputs.arch }}
+ run: |
+ npm run update-build-info
+ ./bin/build-server.sh
+ - name: Prepare artifacts
+ run: |
+ mkdir -p upload
+ file=$(find dist -name '*.tar.xz' -print -quit)
+ cp "$file" "upload/TriliumNextNotes-linux-${{ inputs.arch }}-${{ github.ref_name }}.tar.xz"
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 7db377eeed..0a852bcd4b 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -7,7 +7,7 @@ on:
paths-ignore:
- "docs/**"
- ".github/workflows/main-docker.yml"
- workflow_dispatch:
+ workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -36,13 +36,13 @@ jobs:
- name: Set up node & dependencies
uses: actions/setup-node@v4
with:
- node-version: 20
+ node-version: 20
- name: Run the build
uses: ./.github/actions/build-electron
with:
- os: ${{ matrix.os.name }}
+ os: ${{ matrix.os.name }}
arch: ${{ matrix.arch }}
- extension: ${{ matrix.os.extension }}
+ extension: ${{ matrix.os.extension }}
- name: Publish artifacts
uses: actions/upload-artifact@v4
with:
@@ -67,24 +67,10 @@ jobs:
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- - name: Set up node & dependencies
- uses: actions/setup-node@v4
+ - name: Run the build
+ uses: ./.github/actions/build-server
with:
- node-version: 20
- cache: "npm"
- - name: Install dependencies
- run: npm ci
- - name: Run Linux server build
- env:
- MATRIX_ARCH: ${{ matrix.arch }}
- run: |
- npm run update-build-info
- ./bin/build-server.sh
- - name: Prepare artifacts
- run: |
- mkdir -p upload
- file=$(find dist -name '*.tar.xz' -print -quit)
- cp "$file" "upload/TriliumNextNotes-linux-${{ matrix.arch }}-${{ github.ref_name }}.tar.xz"
+ arch: ${{ matrix.arch }}
- uses: actions/upload-artifact@v4
with:
name: TriliumNextNotes linux server ${{ matrix.arch }}
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 7cf0386077..5021d6f660 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -12,7 +12,7 @@ permissions:
contents: write
jobs:
nightly-electron:
- name: Deploy nightly
+ name: Deploy nightly
strategy:
fail-fast: false
matrix:
@@ -27,7 +27,7 @@ jobs:
- name: windows
image: windows-latest
extension: exe
- runs-on: ${{ matrix.os.image }}
+ runs-on: ${{ matrix.os.image }}
steps:
- uses: actions/checkout@v4
- name: Set up node & dependencies
@@ -39,7 +39,7 @@ jobs:
- name: Run the build
uses: ./.github/actions/build-electron
with:
- os: ${{ matrix.os.name }}
+ os: ${{ matrix.os.name }}
arch: ${{ matrix.arch }}
extension: ${{ matrix.os.extension }}
- name: Publish artifacts
@@ -85,24 +85,12 @@ jobs:
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- - name: Set up node & dependencies
- uses: actions/setup-node@v4
+
+ - name: Run the build
+ uses: ./.github/actions/build-server
with:
- node-version: 20
- cache: "npm"
- - name: Install dependencies
- run: npm ci
- - name: Run Linux server build
- env:
- MATRIX_ARCH: ${{ matrix.arch }}
- run: |
- npm run update-build-info
- ./bin/build-server.sh
- - name: Prepare artifacts
- run: |
- mkdir -p upload
- file=$(find dist -name '*.tar.xz' -print -quit)
- cp "$file" "upload/TriliumNextNotes-linux-${{ matrix.arch }}-${{ github.ref_name }}.tar.xz"
+ arch: ${{ matrix.arch }}
+
- uses: actions/upload-artifact@v4
with:
name: TriliumNextNotes linux server ${{ matrix.arch }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 86b424ee44..06aefbefb8 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -3,7 +3,7 @@ on:
push:
tags:
- "v*"
- workflow_dispatch:
+ workflow_dispatch:
permissions:
contents: write
concurrency:
@@ -37,8 +37,8 @@ jobs:
- name: Run the build
uses: ./.github/actions/build-electron
with:
- os: ${{ matrix.os.name }}
- arch: ${{ matrix.arch }}
+ os: ${{ matrix.os.name }}
+ arch: ${{ matrix.arch }}
extension: ${{ matrix.os.extension }}
- name: Publish release
uses: softprops/action-gh-release@v2
@@ -60,27 +60,15 @@ jobs:
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- - name: Set up node & dependencies
- uses: actions/setup-node@v4
+
+ - name: Run the build
+ uses: ./.github/actions/build-server
with:
- node-version: 20
- cache: "npm"
- - name: Install dependencies
- run: npm ci
- - name: Run Linux server build
- env:
- MATRIX_ARCH: ${{ matrix.arch }}
- run: |
- npm run update-build-info
- ./bin/build-server.sh
- - name: Prepare artifacts
- run: |
- mkdir -p upload
- file=$(find dist -name '*.tar.xz' -print -quit)
- cp "$file" "upload/TriliumNextNotes-linux-${{ matrix.arch }}-${{ github.ref_name }}.tar.xz"
+ arch: ${{ matrix.arch }}
+
- name: Publish release
uses: softprops/action-gh-release@v2
with:
draft: true
fail_on_unmatched_files: true
- files: upload/*.*
\ No newline at end of file
+ files: upload/*.*