Files
logseq/.github/workflows/build-android.yml
megayu 76285de44b refactor: toolchain upgrade (#12517)
* chore(deps): upgrade Clojure version to 1.12.4 across multiple dependency files

* chore: bump shadow-cljs to 3.3.6

* chore: bump org.clojure/clojurescript to 1.12.134

* chore(deps): upgrade Clojure version to 1.12.4 in workflow files

* chore(deps): upgrade Java version to 21 in workflow files

* chore(deps): upgrade Node.js version to 24 in workflow files

* chore(deps): upgrade Node.js version to 24 in Dockerfile

* feat(updater): migrate electron-forge to electron-builder

* fix wrong android app version

* fix workflow

* feat(dependency-upgrade): add max-update-interval option for dependency audits

* chore(deps): upgrade electron-builder and electron-updater

* fix: update manual verification instructions for Electron shim cache

* chore: update shadow-cljs version to 3.4.4 across all dependencies

* chore: upgrade electron version to 41.2.1

* chore: update metosin/malli dependency to latest

* chore: upgrade cider-nrepl version to 0.59.0 in dependencies

* chore: upgrade clj-kondo version to 2026.04.15 and fix warning

* chore: move Electron windows build configuration from yml to ci

* chore: update Electron signing configuration to extend from base config

* fix: replace icon file for NSIS compatibility

* chore: resolve metosin/malli version conflicts

* chore: upgrade jdk to 21 in e2e workflow

---------

Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
2026-04-17 19:40:01 +08:00

162 lines
5.3 KiB
YAML

# This is the main Android apk build workflow for both nightly and beta releases.
# This is also configured to run as a workflow_call.
name: Build-Android
on:
workflow_dispatch:
inputs:
build-target:
description: 'Build Target (Release Type)'
type: choice
required: true
options:
- beta
- nightly
- non-release
default: "non-release"
git-ref:
description: "Build from Git Ref(master)"
required: true
default: "master"
enable-file-sync-production:
description: 'File sync production mode'
type: boolean
required: true
default: true
workflow_call:
inputs:
build-target:
type: string
required: true
enable-file-sync-production:
description: 'File sync production mode'
type: boolean
secrets:
ANDROID_KEYSTORE:
required: true
ANDROID_KEYSTORE_PASSWORD:
required: true
SENTRY_AUTH_TOKEN:
required: true
env:
CLOJURE_VERSION: '1.12.4.1618'
NODE_VERSION: '24'
JAVA_VERSION: '21'
jobs:
build-apk:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.git-ref }}
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache yarn cache directory
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
- name: Cache clojure deps
uses: actions/cache@v4
with:
path: |
~/.m2/repository
~/.gitlibs
key: ${{ runner.os }}-clojure-lib-${{ hashFiles('**/deps.edn') }}
- name: Setup clojure
uses: DeLaGuardo/setup-clojure@13.5
with:
cli: ${{ env.CLOJURE_VERSION }}
- name: Retrieve tag version
id: ref
run: |
pkgver=$(node ./scripts/get-pkg-version.js "${{ inputs.build-target || github.event.inputs.build-target }}")
echo "version=$pkgver" >> $GITHUB_OUTPUT
- name: Update Nightly APP Version
if: ${{ inputs.build-target == '' || inputs.build-target == 'nightly' || github.event.inputs.build-target == 'nightly' }}
run: |
sed -i 's/defonce version ".*"/defonce version "${{ steps.ref.outputs.version }}"/g' src/main/frontend/version.cljs
sed -i 's/versionName ".*"/versionName "${{ steps.ref.outputs.version }}"/g' android/app/build.gradle
- name: Set Build Environment Variables
run: |
echo "ENABLE_FILE_SYNC_PRODUCTION=${{ inputs.enable-file-sync-production || github.event.inputs.enable-file-sync-production || inputs.build-target == '' }}" >> $GITHUB_ENV
- name: Compile CLJS - app variant, use es6 instead of es-next
run: yarn install && yarn release-mobile
env:
LOGSEQ_SENTRY_DSN: ${{ secrets.LOGSEQ_SENTRY_DSN }}
LOGSEQ_POSTHOG_TOKEN: ${{ secrets.LOGSEQ_POSTHOG_TOKEN }}
- name: Upload Sentry Sourcemaps (beta only)
# if: ${{ github.repository == 'logseq/logseq' && (inputs.build-target == 'beta' || github.event.inputs.build-target == 'beta') }}
run: |
curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=2.58.4 bash
release_name="logseq-android@${{ steps.ref.outputs.version }}"
sentry-cli releases new "${release_name}"
sentry-cli releases files "${release_name}" upload-sourcemaps --ext map --ext js ./static/js --url-prefix '~/static/js'
sentry-cli releases finalize "${release_name}"
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: logseq
SENTRY_PROJECT: logseq
- name: Sync public to Android Project
run: npx cap sync android
- name: Setup Android SDK
uses: android-actions/setup-android@v3.2.2
- name: Build Android
run: |
./gradlew clean
./gradlew zipApksForRelease
working-directory: android
env:
LOGSEQ_SENTRY_DSN: ${{ secrets.LOGSEQ_SENTRY_DSN }}
- name: Sign Android APK
run: |
echo ${{ secrets.ANDROID_KEYSTORE }} | base64 -d > keystore.jks
$ANDROID_SDK_ROOT/build-tools/34.0.0/apksigner sign \
--ks keystore.jks --ks-pass "pass:${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" \
--in app/build/outputs/apk/release/app-release-unsigned.apk \
--out app-signed.apk
working-directory: android
- name: Rename Apk
run: |
mkdir builds
mv android/app-signed.apk ./builds/Logseq-android-${{ steps.ref.outputs.version }}.apk
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: logseq-android-builds
path: builds