Skip to content

Commit 81b31e9

Browse files
authored
Auto validate with play store (#794)
1 parent b99bcb0 commit 81b31e9

File tree

3 files changed

+86
-2
lines changed

3 files changed

+86
-2
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Android Upload
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ master ]
7+
paths:
8+
- '.github/workflows/android-upload.yml'
9+
- 'demo/android/**/build.gradle'
10+
pull_request:
11+
branches: [ master, 'v[0-9]+.[0-9]+' ]
12+
paths:
13+
- '.github/workflows/android-upload.yml'
14+
- 'demo/android/**/build.gradle'
15+
16+
jobs:
17+
upload-demo:
18+
runs-on: ubuntu-latest
19+
defaults:
20+
run:
21+
working-directory: demo/android/Activity
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
26+
- name: set up JDK 17
27+
uses: actions/setup-java@v3
28+
with:
29+
java-version: 17
30+
distribution: 'temurin'
31+
32+
- name: Set up service json
33+
run: echo ${{secrets.GOOGLE_PLAY_SERVICE_JSON}} | base64 -d > ./service-account.json
34+
35+
- name: Override version code
36+
run: |
37+
VC=`fastlane run google_play_track_version_codes \
38+
json_key:"./service-account.json" \
39+
package_name:"ai.picovoice.rhinodemo.en" \
40+
track:"internal" \
41+
| grep -oP '(?<=Result: \[)\d+(?=\])' \
42+
| awk '{print $1+1}'`
43+
sed -i "s/versionCode [0-9]*/versionCode $VC/g" rhino-activity-demo-app/build.gradle
44+
- name: Inject Android keystore variables
45+
run: |
46+
echo storePassword="${{secrets.ANDROID_RELEASE_KEYSTORE_PASSWORD}}" >> local.properties
47+
echo keyPassword="${{secrets.ANDROID_RELEASE_KEYSTORE_PASSWORD}}" >> local.properties
48+
echo keyAlias=picovoice >> local.properties
49+
echo storeFile=../picovoice.jks >> local.properties
50+
- name: Setup Android keystore file
51+
run: echo "${{secrets.ANDROID_RELEASE_KEYSTORE_FILE_B64}}" | base64 -d > picovoice.jks
52+
53+
- name: Build
54+
run: ./gradlew bundleRelease
55+
56+
- name: Upload to Google Play
57+
run: fastlane supply --json_key ./service-account.json --package_name ai.picovoice.rhinodemo.en --aab rhino-activity-demo-app/build/outputs/bundle/enRelease/rhino-activity-demo-app-en-release.aab --track internal --skip_upload_metadata --skip_upload_images --skip_upload_screenshots --release_status draft

demo/android/Activity/rhino-activity-demo-app/build.gradle

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@ import groovy.json.JsonSlurper
22

33
apply plugin: 'com.android.application'
44

5+
Properties properties = new Properties()
6+
if (rootProject.file("local.properties").exists()) {
7+
properties.load(rootProject.file("local.properties").newDataInputStream())
8+
if (project.hasProperty("storePassword")) {
9+
properties.put("storePassword", project.getProperty("storePassword"))
10+
}
11+
if (project.hasProperty("storeFile")) {
12+
properties.put("storeFile", project.getProperty("storeFile"))
13+
}
14+
if (project.hasProperty("keyAlias")) {
15+
properties.put("keyAlias", project.getProperty("keyAlias"))
16+
}
17+
if (project.hasProperty("keyPassword")) {
18+
properties.put("keyPassword", project.getProperty("keyPassword"))
19+
}
20+
}
21+
522
android {
623
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
724
compileSdk defaultTargetSdkVersion
@@ -13,10 +30,20 @@ android {
1330
versionCode 1
1431
versionName "1.0"
1532
}
33+
34+
signingConfigs {
35+
release {
36+
storePassword properties.getProperty("storePassword")
37+
storeFile file(properties.getProperty("storeFile", ".dummy.jks"))
38+
keyAlias properties.getProperty("keyAlias")
39+
keyPassword properties.getProperty("keyPassword")
40+
}
41+
}
1642
buildTypes {
1743
release {
1844
minifyEnabled true
1945
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
46+
signingConfig signingConfigs.release
2047
}
2148
}
2249
buildFeatures {

demo/nodejs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ index: 1, device name: MacBook Air Microphone
8383

8484
Specify the input audio device with `--audio_device_index` and the Speech-to-Intent context (.rhn file) with `--context` and provide your Picovoice AccessKey with `--access_key`.
8585

86-
Here is an example using USB Audio Device and commands from the "Smart Lighting" demo from the [Rhino GitHub repository](https://github.com/Picovoice/rhino/blob/master/resources/contexts/) (note that context files are platform-dependent; choose the appropriate one for the platform you are using; this demo uses the "mac" version)
86+
Here is an example using USB Audio Device and commands from the "Smart Lighting" demo from the [Rhino repository](../../resources/contexts/) (note that context files are platform-dependent; choose the appropriate one for the platform you are using; this demo uses the "mac" version)
8787

8888
```console
8989
rhn-mic-demo --access_key ${ACCESS_KEY} --context ./smart_lighting_mac.rhn --audio_device_index 0
@@ -145,7 +145,7 @@ The file-based demo allows you to scan a compatible wave file with Rhino. Note:
145145

146146
To run the file-based demo, we need to provide a Speech-to-Intent context along with a path to a compatible WAV file.
147147

148-
We can use a couple of test WAV files that are bundled in the [Rhino GitHub repository](https://github.com/Picovoice/rhino/blob/master/resources/audio_samples/). These are intended to be used with the sample "Coffee Maker" context, also available in the [Rhino GitHub repository](https://github.com/Picovoice/rhino/blob/master/resources/contexts/) (note that context files are platform-dependent; choose the appropriate one for the platform you are using; this demo uses the "mac" version)
148+
We can use a couple of test WAV files that are bundled in the [Rhino repository](../../resources/audio_samples/). These are intended to be used with the sample "Coffee Maker" context, also available in the [Rhino repository](../../resources/contexts/) (note that context files are platform-dependent; choose the appropriate one for the platform you are using; this demo uses the "mac" version)
149149

150150
Run the file demo, and the successful inference with the intent "orderDrink" along with the specific details are returned:
151151

0 commit comments

Comments
 (0)