refactor(ci): deduplicate server build

This commit is contained in:
Elian Doran 2025-02-04 21:49:10 +02:00
parent 711ab84557
commit 6ae143cc38
No known key found for this signature in database
4 changed files with 49 additions and 62 deletions

25
.github/actions/build-server/action.yml vendored Normal file
View File

@ -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"

View File

@ -7,7 +7,7 @@ on:
paths-ignore: paths-ignore:
- "docs/**" - "docs/**"
- ".github/workflows/main-docker.yml" - ".github/workflows/main-docker.yml"
workflow_dispatch: workflow_dispatch:
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
@ -36,13 +36,13 @@ jobs:
- name: Set up node & dependencies - name: Set up node & dependencies
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
- name: Run the build - name: Run the build
uses: ./.github/actions/build-electron uses: ./.github/actions/build-electron
with: with:
os: ${{ matrix.os.name }} os: ${{ matrix.os.name }}
arch: ${{ matrix.arch }} arch: ${{ matrix.arch }}
extension: ${{ matrix.os.extension }} extension: ${{ matrix.os.extension }}
- name: Publish artifacts - name: Publish artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
@ -67,24 +67,10 @@ jobs:
runs-on: ${{ matrix.runs-on }} runs-on: ${{ matrix.runs-on }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up node & dependencies - name: Run the build
uses: actions/setup-node@v4 uses: ./.github/actions/build-server
with: with:
node-version: 20 arch: ${{ matrix.arch }}
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"
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: TriliumNextNotes linux server ${{ matrix.arch }} name: TriliumNextNotes linux server ${{ matrix.arch }}

View File

@ -12,7 +12,7 @@ permissions:
contents: write contents: write
jobs: jobs:
nightly-electron: nightly-electron:
name: Deploy nightly name: Deploy nightly
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -27,7 +27,7 @@ jobs:
- name: windows - name: windows
image: windows-latest image: windows-latest
extension: exe extension: exe
runs-on: ${{ matrix.os.image }} runs-on: ${{ matrix.os.image }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up node & dependencies - name: Set up node & dependencies
@ -39,7 +39,7 @@ jobs:
- name: Run the build - name: Run the build
uses: ./.github/actions/build-electron uses: ./.github/actions/build-electron
with: with:
os: ${{ matrix.os.name }} os: ${{ matrix.os.name }}
arch: ${{ matrix.arch }} arch: ${{ matrix.arch }}
extension: ${{ matrix.os.extension }} extension: ${{ matrix.os.extension }}
- name: Publish artifacts - name: Publish artifacts
@ -85,24 +85,12 @@ jobs:
runs-on: ${{ matrix.runs-on }} runs-on: ${{ matrix.runs-on }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up node & dependencies
uses: actions/setup-node@v4 - name: Run the build
uses: ./.github/actions/build-server
with: with:
node-version: 20 arch: ${{ matrix.arch }}
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"
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: TriliumNextNotes linux server ${{ matrix.arch }} name: TriliumNextNotes linux server ${{ matrix.arch }}

View File

@ -3,7 +3,7 @@ on:
push: push:
tags: tags:
- "v*" - "v*"
workflow_dispatch: workflow_dispatch:
permissions: permissions:
contents: write contents: write
concurrency: concurrency:
@ -37,8 +37,8 @@ jobs:
- name: Run the build - name: Run the build
uses: ./.github/actions/build-electron uses: ./.github/actions/build-electron
with: with:
os: ${{ matrix.os.name }} os: ${{ matrix.os.name }}
arch: ${{ matrix.arch }} arch: ${{ matrix.arch }}
extension: ${{ matrix.os.extension }} extension: ${{ matrix.os.extension }}
- name: Publish release - name: Publish release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
@ -60,27 +60,15 @@ jobs:
runs-on: ${{ matrix.runs-on }} runs-on: ${{ matrix.runs-on }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up node & dependencies
uses: actions/setup-node@v4 - name: Run the build
uses: ./.github/actions/build-server
with: with:
node-version: 20 arch: ${{ matrix.arch }}
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"
- name: Publish release - name: Publish release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
draft: true draft: true
fail_on_unmatched_files: true fail_on_unmatched_files: true
files: upload/*.* files: upload/*.*