Skip to content

Commit 14edc08

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

File tree

3 files changed

+97
-5
lines changed

3 files changed

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

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)