Skip to content

Build your personal knowledge base with Trilium Notes

feat(ci): deploy mobile on nightlies instead of push to main

Elian Doranc030551bcb43
diff --git a/.github/actions/build-mobile/action.yml b/.github/actions/build-mobile/action.yml
new file mode 100644
index 0000000000..de0185e8b6
--- /dev/null
+++ b/.github/actions/build-mobile/action.yml
@@ -0,0 +1,53 @@
+inputs:
+ upload-artifact:
+ description: "Whether to upload the APK as a workflow artifact"
+ required: false
+ default: "true"
+runs:
+ using: composite
+ steps:
+ - uses: pnpm/action-setup@v6
+ - name: Set up Node.js
+ uses: actions/setup-node@v6
+ with:
+ node-version: 24
+ cache: "pnpm"
+
+ - name: Set up JDK 21
+ uses: actions/setup-java@v5
+ with:
+ distribution: temurin
+ java-version: 21
+
+ - name: Set up Gradle
+ uses: gradle/actions/setup-gradle@v6
+
+ - name: Install dependencies
+ shell: bash
+ run: pnpm install --frozen-lockfile
+
+ - name: Update build info
+ shell: bash
+ run: pnpm run chore:update-build-info
+
+ - name: Build standalone (webDir for Capacitor)
+ shell: bash
+ run: pnpm --filter @triliumnext/mobile build
+
+ - name: Sync Capacitor Android project
+ shell: bash
+ run: pnpm --filter @triliumnext/mobile exec cap sync android
+
+ - name: Assemble debug APK
+ shell: bash
+ working-directory: apps/mobile/android
+ run: ./gradlew assembleDebug --no-daemon
+
+ - name: Upload APK
+ if: ${{ inputs.upload-artifact == 'true' }}
+ uses: actions/upload-artifact@v7
+ with:
+ name: trilium-mobile-debug-apk
+ path: apps/mobile/android/app/build/outputs/apk/debug/*.apk
+ retention-days: 14
+ archive: false
diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml
index 0ae38d7832..e3244c1501 100644
--- a/.github/workflows/mobile.yml
+++ b/.github/workflows/mobile.yml
@@ -1,9 +1,6 @@
name: Mobile
on:
- push:
- branches:
- - main
pull_request:
paths:
- "apps/mobile/**"
@@ -13,6 +10,7 @@ on:
- "pnpm-lock.yaml"
- "package.json"
- ".github/workflows/mobile.yml"
+ - ".github/actions/build-mobile/**"
workflow_dispatch:
permissions:
@@ -32,43 +30,5 @@ jobs:
- name: Checkout the repository
uses: actions/checkout@v6
- - uses: pnpm/action-setup@v6
-
- - name: Set up Node.js
- uses: actions/setup-node@v6
- with:
- node-version: 24
- cache: "pnpm"
-
- - name: Set up JDK 21
- uses: actions/setup-java@v5
- with:
- distribution: temurin
- java-version: 21
-
- - name: Set up Gradle
- uses: gradle/actions/setup-gradle@v6
-
- - name: Install dependencies
- run: pnpm install --frozen-lockfile
-
- - name: Update build info
- run: pnpm run chore:update-build-info
-
- - name: Build standalone (webDir for Capacitor)
- run: pnpm --filter @triliumnext/mobile build
-
- - name: Sync Capacitor Android project
- run: pnpm --filter @triliumnext/mobile exec cap sync android
-
- - name: Assemble debug APK
- working-directory: apps/mobile/android
- run: ./gradlew assembleDebug --no-daemon
-
- - name: Upload APK
- uses: actions/upload-artifact@v7
- with:
- name: trilium-mobile-debug-apk
- path: apps/mobile/android/app/build/outputs/apk/debug/*.apk
- retention-days: 14
- archive: false
+ - name: Build mobile APK
+ uses: ./.github/actions/build-mobile
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 1b505b74db..ab305df92e 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -111,6 +111,26 @@ jobs:
name: TriliumNotes ${{ matrix.os.name }} ${{ matrix.arch }}
path: apps/desktop/upload
+ nightly-mobile:
+ if: ${{ github.repository == vars.REPO_MAIN && github.event_name != 'pull_request' }}
+ name: Build mobile nightly
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v6
+
+ - name: Build mobile APK
+ uses: ./.github/actions/build-mobile
+
+ - name: Publish release
+ uses: softprops/[email protected]
+ with:
+ make_latest: false
+ prerelease: true
+ draft: false
+ files: apps/mobile/android/app/build/outputs/apk/debug/*.apk
+ tag_name: nightly
+ name: Mobile Nightly
+
nightly-server:
if: ${{ github.repository == vars.REPO_MAIN }}
name: Deploy server nightly