Skip to content

Commit f63270c

Browse files
committed
Add android publishing github action
1 parent c31e804 commit f63270c

File tree

3 files changed

+95
-5
lines changed

3 files changed

+95
-5
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Publish Android
2+
3+
env:
4+
ANDROID_SDK_VERSION: "36.1.0"
5+
6+
on:
7+
push:
8+
tags:
9+
- "v*.*.*"
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
build:
16+
strategy:
17+
matrix:
18+
target: [android]
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Set up JDK 21
26+
uses: actions/setup-java@v3
27+
with:
28+
java-version: "21"
29+
distribution: "temurin"
30+
31+
- name: Setup Android SDK
32+
uses: android-actions/setup-android@v3
33+
34+
- name: Install Android SDK build tools
35+
run: |
36+
sdkmanager "build-tools;${{env.ANDROID_SDK_VERSION}}"
37+
echo "$ANDROID_SDK_ROOT/build-tools/${{env.ANDROID_SDK_VERSION}}" >> $GITHUB_PATH
38+
39+
- name: Get Keystore
40+
run: |
41+
mkdir ~/.keystore
42+
echo ${{ secrets.ANDROID_KEYSTORE }} | base64 --decode > ~/.keystore/pulse-editor.keystore
43+
44+
- name: Setup Node.js
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: 20
48+
49+
- name: Install shared-utils dependencies
50+
run: npm install --workspace=npm-packages/shared-utils
51+
52+
- name: Build shared-utils
53+
run: npm run shared-utils-build
54+
55+
- name: Install web dependencies
56+
run: npm install --workspace=web
57+
58+
- name: Save public env variables into .env file
59+
run: |
60+
echo NEXT_PUBLIC_BACKEND_URL=$NEXT_PUBLIC_BACKEND_URL >> ./web/.env
61+
echo NEXT_PUBLIC_CDN_URL=$NEXT_PUBLIC_CDN_URL >> ./web/.env
62+
echo NEXT_PUBLIC_STORAGE_CONTAINER=$NEXT_PUBLIC_STORAGE_CONTAINER >> ./web/.env
63+
env:
64+
NEXT_PUBLIC_BACKEND_URL: ${{ vars.NEXT_PUBLIC_BACKEND_URL }}
65+
NEXT_PUBLIC_CDN_URL: ${{ vars.NEXT_PUBLIC_CDN_URL }}
66+
NEXT_PUBLIC_STORAGE_CONTAINER: ${{ vars.NEXT_PUBLIC_STORAGE_CONTAINER }}
67+
68+
- name: Build Web App
69+
run: npm run web-build
70+
71+
- name: Install mobile dependencies
72+
run: npm install --workspace=mobile
73+
74+
- name: Change Android Project Permission
75+
run: chmod +x mobile/android/gradlew
76+
77+
- name: Sync Capacitor App
78+
run: npx cap sync
79+
working-directory: mobile
80+
81+
- name: Build Capacitor App
82+
run: npx cap build android --keystorepath ~/.keystore/pulse-editor.keystore --keystorepass ${{ secrets.ANDROID_KEYSTORE_PASS }} --keystorealias ${{ secrets.ANDROID_KEYSTORE_ALIAS }} --keystorealiaspass ${{ secrets.ANDROID_KEYSTORE_ALIAS_PASS }} --androidreleasetype AAB --signing-type jarsigner
83+
working-directory: mobile
84+
85+
- name: Publish to Play Store
86+
uses: r0adkll/upload-google-play@v1
87+
with:
88+
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
89+
packageName: com.pulse_editor.app
90+
releaseFiles: mobile/android/app/build/outputs/bundle/release/app-release-signed.aab
91+
track: internal
92+
status: draft

mobile/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Android release
22
```bash
33
npx cap sync
4-
# Build .aab file (will fail signing, use the next command to fix)
5-
npx cap build android --keystorepath "<path_to_keystore>" --keystorepass "<keystore_pass>" --keystorealias "<keystore_alias>" --keystorealiaspass "<keystore_alias_pass>" --androidreleasetype AAB
6-
# Sign the .aab
7-
jarsigner -verbose -keystore "<path_to_keystore>" "<path_to_aab>" "<keystore_alias>"
4+
# Build .aab file
5+
npx cap build android --keystorepath "<path_to_keystore>" --keystorepass "<keystore_pass>" --keystorealias "<keystore_alias>" --keystorealiaspass "<keystore_alias_pass>" --androidreleasetype AAB --signing-type jarsigner
86
```
97

108
Then, `mobile/android/app/build/outputs/bundle/release/app-released.aab` is a signed .aab ready for publishing.

mobile/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ android {
77
applicationId "com.pulse_editor.app"
88
minSdkVersion rootProject.ext.minSdkVersion
99
targetSdkVersion rootProject.ext.targetSdkVersion
10-
versionCode 1
10+
versionCode 2
1111
versionName "v0.1.1-beta"
1212
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1313
aaptOptions {

0 commit comments

Comments
 (0)