-
Notifications
You must be signed in to change notification settings - Fork 3
195 lines (165 loc) · 8.01 KB
/
Copy pathandroid.yml
File metadata and controls
195 lines (165 loc) · 8.01 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: 'publish-android'
on:
push:
branches:
- release
workflow_dispatch:
jobs:
publish-android:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Recover Android SDK and NDK cache
uses: actions/cache/restore@v4
id: ndk-cache-restore
with:
path: ${{ github.workspace }}/android-sdk
key: ${{ runner.os }}-android-sdk-and-ndk
env:
ANDROID_HOME: ${{ github.workspace }}/android-sdk
ANDROID_SDK_ROOT: ${{ github.workspace }}/android-sdk
- name: Setup Android SDK
uses: android-actions/setup-android@v3
if: steps.ndk-cache-restore.outputs.cache-hit != 'true'
env:
ANDROID_HOME: ${{ github.workspace }}/android-sdk
ANDROID_SDK_ROOT: ${{ github.workspace }}/android-sdk
- name: Install NDK
run: sdkmanager "ndk;27.0.11902837"
if: steps.ndk-cache-restore.outputs.cache-hit != 'true'
env:
ANDROID_HOME: ${{ github.workspace }}/android-sdk
ANDROID_SDK_ROOT: ${{ github.workspace }}/android-sdk
- name: Store Android SDK and NDK cache
uses: actions/cache/save@v4
id: ndk-cache-save
if: steps.ndk-cache-restore.outputs.cache-hit != 'true'
with:
path: ${{ github.workspace }}/android-sdk
key: ${{ runner.os }}-android-sdk-and-ndk
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
#cache: 'npm'
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- name: Restore npm cache
uses: actions/cache/restore@v4
id: npm-cache-restore
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Generate npm cache
uses: actions/cache/save@v4
if: steps.npm-cache-restore.outputs.cache-hit != 'true'
id: npm-cache-save
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ steps.npm-cache-restore.outputs.cache-primary-key }}
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android
# - name: Install dependencies
# run: pnpm install
- name: setup Android signing
env:
ANDROID_RELEASE_KEY: ${{ secrets.ANDROID_RELEASE_KEY }}
ANDROID_RELEASE_PASSWORD: ${{ secrets.ANDROID_RELEASE_PASSWORD }}
ANDROID_RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }}
ANDROID_RELEASE_KEYSTORE: ${{ secrets.ANDROID_RELEASE_KEYSTORE }}
run: |
echo "keyAlias=$ANDROID_RELEASE_KEY" > src-tauri/gen/android/keystore.properties
echo "storePassword=$ANDROID_RELEASE_PASSWORD" >> src-tauri/gen/android/keystore.properties
echo "keyPassword=$ANDROID_RELEASE_KEY_PASSWORD" >> src-tauri/gen/android/keystore.properties
base64 -d <<< "$ANDROID_RELEASE_KEYSTORE" > $RUNNER_TEMP/keystore.jks
echo "storeFile="$RUNNER_TEMP"/keystore.jks" >> src-tauri/gen/android/keystore.properties
- name: install frontend dependencies
# If you don't have `beforeBuildCommand` configured you may want to build your frontend here too.
#run: npm install --save-dev @tauri-apps/cli # change this to npm or pnpm depending on which one you use.
run: |
npm clean-install --include prod --include dev --include peer --verbose
npm install --save-dev @tauri-apps/cli @tauri-apps/api rollup
- name: Check src-tauri permissions
run: |
ls -al `find src-tauri/gen/`
ls -al src-tauri/ src-tauri/*
ls -al $RUNNER_TEMP
cat src-tauri/gen/android/keystore.properties
cat src-tauri/gen/android/keystore.properties | base64
- name: Restore Cargo cache
uses: actions/cache/restore@v4
id: cargo-cache-restore
with:
path: |
~/.cargo/
addiction-tracker/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Restore gradle cache
uses: actions/cache/restore@v4
id: gradle-cache-restore
with:
path: |
~/.gradle/
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- name: Build app bundle
run: npm run tauri android build
# run: npm run tauri info
env:
NDK_HOME: ${{ github.workspace }}/android-sdk/ndk/27.0.11902837
GOOGLE_GEMINI_PROJECT_NAME: ${{ secrets.GOOGLE_GEMINI_PROJECT_NAME }}
GOOGLE_GEMINI_API: ${{ secrets.GOOGLE_GEMINI_API }}
- name: Create gradle cache
uses: actions/cache/save@v4
id: gradle-cache-create
if: steps.gradle-cache-restore.outputs.cache-hit != 'true'
with:
path: |
~/.gradle/
key: ${{ steps.gradle-cache-restore.outputs.cache-primary-key }}
- name: Create cargo cache
uses: actions/cache/save@v4
id: cargo-cache-save
if: steps.cargo-cache-restore.outputs.cache-hit != 'true'
with:
path: |
~/.cargo/
addiction-tracker/target/
key: ${{ steps.cargo-cache-restore.outputs.cache-primary-key }}
- name: Shows the generated packages
run: |
echo "Files on the outputs directory, apk"
find src-tauri/gen/android/app/build/outputs/ -name "*.apk"
echo "Files on the outputs directory, aab"
find src-tauri/gen/android/app/build/outputs/ -name "*.aab"
- name: Get Node project version
id: package-version
uses: martinbeentjes/npm-get-version-action@v1.3.1
- name: Publish
uses: softprops/action-gh-release@v1
with:
draft: true
name: App v${{ steps.package-version.outputs.current-version}} (Android)
tag_name: android-v${{ steps.package-version.outputs.current-version}}
generate_release_notes: true
files: |
src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk
src-tauri/gen/android/app/build/outputs/bundle/universalRelease/app-universal-release.aab
- name: Google Play AAB Upload
uses: italankin/google-play-aab-uploader@1.3
with:
package-name: com.addictiontracker
aab-path: src-tauri/gen/android/app/build/outputs/bundle/universalRelease/app-universal-release.aab
key-json: '${{ secrets.GOOGLE_SERVICE_KEY_JSON }}'