Skip to content

Commit 1fa2b1a

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

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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-mobile.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
86+
working-directory: mobile
87+
88+
- name: Sign the AAB
89+
run: jarsigner -verbose -keystore "~/.keystore/pulse-editor.keystore" -storepass "${{ secrets.ANDROID_KEYSTORE_PASS }}" -keypass "${{ secrets.ANDROID_KEYSTORE_ALIAS_PASS }}" "mobile/build/outputs/bundle/release/app-release.aab" "${{ secrets.ANDROID_KEYSTORE_ALIAS }}"
90+
91+
- name: Publish to Play Store
92+
uses: r0adkll/upload-google-play@v1
93+
with:
94+
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
95+
packageName: com.pulse_editor.app
96+
releaseFiles: mobile/android/app/build/outputs/bundle/release/app-release.aab
97+
track: internal

0 commit comments

Comments
 (0)