2021-12-22 16:46:32 +00:00
|
|
|
# This is the main Android apk build workflow for both nightly and beta releases.
|
|
|
|
# This is also configured to run as a workflow_call.
|
2021-12-22 06:34:34 +00:00
|
|
|
|
2021-12-22 16:46:32 +00:00
|
|
|
name: Build-Android
|
2021-12-22 06:34:34 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
build-target:
|
2022-08-10 01:13:34 +00:00
|
|
|
description: 'Build Target (Release Type)'
|
|
|
|
type: choice
|
2021-12-22 06:34:34 +00:00
|
|
|
required: true
|
2022-08-10 01:13:34 +00:00
|
|
|
options:
|
|
|
|
- beta
|
|
|
|
- nightly
|
|
|
|
- non-release
|
|
|
|
default: "non-release"
|
2022-03-21 08:15:40 +00:00
|
|
|
git-ref:
|
|
|
|
description: "Build from Git Ref(master)"
|
|
|
|
required: true
|
|
|
|
default: "master"
|
2022-08-31 16:31:49 +00:00
|
|
|
enable-file-sync-production:
|
|
|
|
description: 'File sync production mode'
|
|
|
|
type: boolean
|
|
|
|
required: true
|
2022-09-01 21:04:28 +00:00
|
|
|
default: true
|
2021-12-22 16:46:32 +00:00
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
build-target:
|
|
|
|
type: string
|
|
|
|
required: true
|
2022-08-31 16:31:49 +00:00
|
|
|
enable-file-sync-production:
|
|
|
|
description: 'File sync production mode'
|
|
|
|
type: boolean
|
2021-12-22 16:46:32 +00:00
|
|
|
secrets:
|
|
|
|
ANDROID_KEYSTORE:
|
|
|
|
required: true
|
|
|
|
ANDROID_KEYSTORE_PASSWORD:
|
|
|
|
required: true
|
2022-03-18 18:50:07 +00:00
|
|
|
SENTRY_AUTH_TOKEN:
|
|
|
|
required: true
|
2021-12-22 06:34:34 +00:00
|
|
|
|
|
|
|
env:
|
2023-11-02 12:51:43 +00:00
|
|
|
CLOJURE_VERSION: '1.11.1.1413'
|
2023-02-21 15:07:35 +00:00
|
|
|
NODE_VERSION: '18'
|
2023-09-25 04:54:47 +00:00
|
|
|
JAVA_VERSION: '17'
|
2021-12-22 06:34:34 +00:00
|
|
|
|
|
|
|
jobs:
|
2021-12-22 16:46:32 +00:00
|
|
|
build-apk:
|
|
|
|
runs-on: ubuntu-latest
|
2021-12-22 06:34:34 +00:00
|
|
|
steps:
|
|
|
|
- name: Check out Git repository
|
2023-01-21 13:10:19 +00:00
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
2022-03-21 08:15:40 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.inputs.git-ref }}
|
2021-12-22 06:34:34 +00:00
|
|
|
|
|
|
|
- name: Install Node.js, NPM and Yarn
|
2023-02-21 15:02:58 +00:00
|
|
|
uses: actions/setup-node@v3
|
2021-12-22 06:34:34 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
|
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
2023-02-21 15:02:58 +00:00
|
|
|
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
2021-12-22 06:34:34 +00:00
|
|
|
|
|
|
|
- name: Cache yarn cache directory
|
2023-02-21 15:02:58 +00:00
|
|
|
uses: actions/cache@v3
|
2021-12-22 06:34:34 +00:00
|
|
|
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
|
2023-02-21 15:02:58 +00:00
|
|
|
uses: actions/setup-java@v3
|
2021-12-22 06:34:34 +00:00
|
|
|
with:
|
2022-09-20 15:40:32 +00:00
|
|
|
distribution: 'zulu'
|
|
|
|
java-version: ${{ env.JAVA_VERSION }}
|
2021-12-22 06:34:34 +00:00
|
|
|
|
|
|
|
- name: Cache clojure deps
|
2023-02-21 15:02:58 +00:00
|
|
|
uses: actions/cache@v3
|
2021-12-22 06:34:34 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.m2/repository
|
|
|
|
~/.gitlibs
|
|
|
|
key: ${{ runner.os }}-clojure-lib-${{ hashFiles('**/deps.edn') }}
|
|
|
|
|
|
|
|
- name: Setup clojure
|
2023-02-21 15:02:58 +00:00
|
|
|
uses: DeLaGuardo/setup-clojure@10.1
|
2021-12-22 06:34:34 +00:00
|
|
|
with:
|
|
|
|
cli: ${{ env.CLOJURE_VERSION }}
|
|
|
|
|
|
|
|
- name: Retrieve tag version
|
|
|
|
id: ref
|
|
|
|
run: |
|
2021-12-22 16:46:32 +00:00
|
|
|
pkgver=$(node ./scripts/get-pkg-version.js "${{ inputs.build-target || github.event.inputs.build-target }}")
|
2023-02-21 15:02:58 +00:00
|
|
|
echo "version=$pkgver" >> $GITHUB_OUTPUT
|
2021-12-22 06:34:34 +00:00
|
|
|
|
|
|
|
- name: Update Nightly APP Version
|
2022-11-16 04:25:14 +00:00
|
|
|
if: ${{ inputs.build-target == '' || inputs.build-target == 'nightly' || github.event.inputs.build-target == 'nightly' }}
|
2021-12-22 06:34:34 +00:00
|
|
|
run: |
|
|
|
|
sed -i 's/defonce version ".*"/defonce version "${{ steps.ref.outputs.version }}"/g' src/main/frontend/version.cljs
|
2021-12-22 16:46:32 +00:00
|
|
|
sed -i 's/versionName ".*"/versionName "${{ steps.ref.outputs.version }}"/g' android/app/build.gradle
|
2021-12-22 06:34:34 +00:00
|
|
|
|
2022-08-14 11:13:52 +00:00
|
|
|
- name: Set Build Environment Variables
|
|
|
|
run: |
|
2022-11-17 01:32:57 +00:00
|
|
|
echo "ENABLE_FILE_SYNC_PRODUCTION=${{ inputs.enable-file-sync-production || github.event.inputs.enable-file-sync-production || inputs.build-target == '' }}" >> $GITHUB_ENV
|
2022-08-14 11:13:52 +00:00
|
|
|
|
2022-12-01 03:21:05 +00:00
|
|
|
- name: Compile CLJS - app variant, use es6 instead of es-next
|
|
|
|
run: yarn install && yarn release-app
|
2022-12-19 14:20:50 +00:00
|
|
|
env:
|
|
|
|
LOGSEQ_SENTRY_DSN: ${{ secrets.LOGSEQ_SENTRY_DSN }}
|
|
|
|
LOGSEQ_POSTHOG_TOKEN: ${{ secrets.LOGSEQ_POSTHOG_TOKEN }}
|
2021-12-22 06:34:34 +00:00
|
|
|
|
2022-03-18 18:50:07 +00:00
|
|
|
- name: Upload Sentry Sourcemaps (beta only)
|
2022-08-14 11:13:52 +00:00
|
|
|
if: ${{ github.repository == 'logseq/logseq' && (inputs.build-target == 'beta' || github.event.inputs.build-target == 'beta') }}
|
2022-03-18 18:50:07 +00:00
|
|
|
run: |
|
|
|
|
curl -sL https://sentry.io/get-cli/ | bash
|
|
|
|
release_name="logseq-android@${{ steps.ref.outputs.version }}"
|
|
|
|
sentry-cli releases new "${release_name}"
|
2022-03-24 06:03:26 +00:00
|
|
|
sentry-cli releases files "${release_name}" upload-sourcemaps --ext map --ext js ./static/js --url-prefix '~/static/js'
|
2022-03-18 18:50:07 +00:00
|
|
|
sentry-cli releases finalize "${release_name}"
|
|
|
|
env:
|
|
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
|
|
SENTRY_ORG: logseq
|
|
|
|
SENTRY_PROJECT: logseq
|
|
|
|
|
2021-12-22 06:34:34 +00:00
|
|
|
- name: Prepare public Directory
|
|
|
|
run: |
|
|
|
|
cp -r static public/
|
|
|
|
rm -rvf public/static/js/publishing
|
|
|
|
rm -rvf public/static/js/*.js.map || true
|
|
|
|
rm -rvf public/static/*.*
|
|
|
|
rm -rvf public/static/ios
|
|
|
|
rm -rvf android/app/src/main/assets/public || true
|
|
|
|
|
|
|
|
- name: Sync public to Android Project
|
2022-11-16 04:25:14 +00:00
|
|
|
run: npx cap sync android
|
2021-12-22 06:34:34 +00:00
|
|
|
|
|
|
|
- name: Setup Android SDK
|
|
|
|
uses: android-actions/setup-android@v2
|
|
|
|
|
|
|
|
- name: Build Android
|
|
|
|
run: |
|
|
|
|
./gradlew clean
|
|
|
|
./gradlew zipApksForRelease
|
|
|
|
working-directory: android
|
2024-01-03 14:04:02 +00:00
|
|
|
env:
|
|
|
|
LOGSEQ_SENTRY_DSN: ${{ secrets.LOGSEQ_SENTRY_DSN }}
|
2021-12-22 06:34:34 +00:00
|
|
|
|
|
|
|
- name: Sign Android APK
|
|
|
|
run: |
|
|
|
|
echo ${{ secrets.ANDROID_KEYSTORE }} | base64 -d > keystore.jks
|
2024-01-12 04:42:29 +00:00
|
|
|
/usr/local/lib/android/sdk/build-tools/33.0.0/apksigner sign \
|
2021-12-22 06:34:34 +00:00
|
|
|
--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
|
|
|
|
|
2021-12-22 16:46:32 +00:00
|
|
|
- name: Rename Apk
|
|
|
|
run: |
|
|
|
|
mkdir builds
|
|
|
|
mv android/app-signed.apk ./builds/Logseq-android-${{ steps.ref.outputs.version }}.apk
|
|
|
|
|
2021-12-22 06:34:34 +00:00
|
|
|
- name: Upload Artifact
|
2023-02-21 15:02:58 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-12-22 06:34:34 +00:00
|
|
|
with:
|
2021-12-22 16:46:32 +00:00
|
|
|
name: logseq-android-builds
|
|
|
|
path: builds
|