forked from demoshang/siyuan-patch
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (109 loc) · 4.37 KB
/
release-android.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: release-android
on:
workflow_dispatch:
inputs:
version:
description: "release version/tag"
required: true
packageManager:
description: "[email protected]"
required: true
jobs:
build:
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- os: ubuntu-20.04
kernel_path: "../../../siyuan-android/app/libs/kernel.aar"
steps:
- uses: actions/checkout@v4
with:
path: siyuan-note
- name: clone origin and apply patches
run: |
mkdir -p ${{ github.workspace }}/go
cd ${{ github.workspace }}/siyuan-note/
git clone --branch ${{ github.event.inputs.version }} --depth=1 https://github.com/siyuan-note/siyuan.git
cd siyuan
git apply ${{ github.workspace }}/siyuan-note/patches/siyuan/disable-update.patch
git apply ${{ github.workspace }}/siyuan-note/patches/siyuan/default-config.patch
git apply ${{ github.workspace }}/siyuan-note/patches/siyuan/mock-vip-user.patch
git status
cd ..
git clone --branch ${{ github.event.inputs.version }} --depth=1 https://github.com/siyuan-note/siyuan-android.git
cd siyuan-android
git apply ${{ github.workspace }}/siyuan-note/patches/siyuan-android/debug-build.patch
mkdir -p app/src/main/assets/
mkdir -p app/libs/
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: ${{ github.workspace }}/siyuan-note/siyuan/kernel/go.mod
cache-dependency-path: "**/*.sum"
- run: go version
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Node pnpm
run: npm install -g ${{ github.event.inputs.packageManager }}
working-directory: ${{ github.workspace }}/siyuan-note/siyuan/app
- name: Install Node Dependencies
run: pnpm install --no-frozen-lockfile
working-directory: ${{ github.workspace }}/siyuan-note/siyuan/app
- name: Building UI
run: pnpm run build
working-directory: ${{ github.workspace }}/siyuan-note/siyuan/app
- name: gomobile
working-directory: ${{ github.workspace }}/go
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
- name: Set up java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: "gradle"
- name: Building Android Kernel
run: |
gomobile bind --tags fts5 -androidapi 21 -target='android/arm64' -ldflags '-s -w' -v -o "${{ matrix.config.kernel_path }}" ./
ls -la "${{ matrix.config.kernel_path }}"
working-directory: ${{ github.workspace }}/siyuan-note/siyuan/kernel/mobile
env:
GO111MODULE: on
CGO_ENABLED: 1
- name: android assets
working-directory: ${{ github.workspace }}/siyuan-note/siyuan/app/
run: |
zip -r ${{ github.workspace }}/siyuan-note/siyuan-android/app/src/main/assets/app.zip ./appearance ./guide ./stage ./changelogs
- name: Decode Keystore
id: decode_keystore
uses: timheuer/[email protected]
with:
fileName: "debug.jks"
fileDir: ${{ github.workspace }}/siyuan-note/siyuan-android/keystore
encodedString: ${{ secrets.KEYSTORE }}
- name: Building Android
working-directory: ${{ github.workspace }}/siyuan-note/siyuan-android
run: |
chmod 777 ./gradlew
./gradlew :app:assembleDebug
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
- uses: joutvhu/get-release@v1
id: get_current_release
with:
tag_name: ${{ github.event.inputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Android
uses: shogo82148/actions-upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_current_release.outputs.upload_url }}
asset_name: siyuan-${{ github.event.inputs.version }}-android-arm64.apk
asset_path: ${{ github.workspace }}/siyuan-note/siyuan-android/app/build/outputs/apk/googleplay/debug/siyuan-*.apk
asset_content_type: application/octet-stream