Skip to content

Commit 066629a

Browse files
feat: [ZN-549] Android adhoc builds
1 parent 6b72844 commit 066629a

File tree

3 files changed

+94
-16
lines changed

3 files changed

+94
-16
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Android Staging Build
2+
3+
# Manual deployment
4+
on: workflow_dispatch
5+
6+
jobs:
7+
build-and-publish:
8+
runs-on: ubuntu-latest
9+
environment: staging
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: actions/setup-node@v4
14+
with:
15+
cache: 'yarn'
16+
node-version-file: .node-version
17+
18+
- name: Setup Java
19+
uses: actions/setup-java@v3
20+
with:
21+
distribution: temurin
22+
java-version: 17
23+
24+
- name: Make .env file
25+
uses: SpicyPizza/[email protected]
26+
with:
27+
envkey_BASE_API_URL: ${{ vars.BASE_API_URL }}
28+
envkey_AUTH_STORAGE_KEY: ${{ vars.AUTH_STORAGE_KEY }}
29+
envkey_DEFAULT_LOCALE: ${{ vars.DEFAULT_LOCALE }}
30+
envkey_MOCK_API: ${{ vars.MOCK_API }}
31+
32+
# Update Google Service File
33+
# - name: Setup Firebase File
34+
# run: echo "${{ secrets.PROD_ANDROID_FIREBASE_FILE }}" > ./android/app/google-services.json
35+
36+
# Setup Production Keystore file
37+
# - name: Setup Keystore File
38+
# run: echo "${{secrets.ANDROID_KEYSTORE_FILE}}" | base64 -d > "${{ github.workspace }}/production.keystore"
39+
40+
# Setup Firebase Service Account file
41+
# - name: Setup Service Account Credential Files
42+
# run: echo "${{secrets.FIREBASE_SERVICE_ACCOUNT_JSON}}" > "${{ github.workspace }}/firebase-service-account.json"
43+
44+
- name: Install
45+
run: yarn install --frozen-lockfile
46+
47+
- name: Setup Ruby
48+
uses: ruby/setup-ruby@v1
49+
with:
50+
ruby-version: '3.2'
51+
bundler-cache: true
52+
53+
- name: Setup Git Config
54+
run: |
55+
git config user.name "GitHub Actions Bot"
56+
git config user.email "<>"
57+
58+
- name: Build and Upload to Firebase
59+
uses: maierj/[email protected]
60+
with:
61+
lane: 'android staging'
62+
env:
63+
# ANDROID_KEYSTORE_FILE: '${{ github.workspace }}/production.keystore'
64+
# ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
65+
# ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
66+
FIREBASE_ANDROID_APP_ID: ${{ secrets.FIREBASE_ANDROID_APP_ID }}
67+
# Not required if you define service_credentials_file in the Fastfile
68+
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
69+
70+
- name: Archive build
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: staging_apk
74+
path: android/app/build/outputs/apk/**/*.apk

fastlane/Fastfile

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,25 @@ end
3030

3131

3232
platform :android do
33-
desc "Android assemble release version"
34-
lane :android_staging do
35-
increment_version_code(gradle_file_path: 'android/app/build.gradle')
33+
desc "Android deploy to Firebase"
34+
lane :staging do
35+
latest_release = firebase_app_distribution_get_latest_release(
36+
app: ENV["FIREBASE_ANDROID_APP_ID"]
37+
)
38+
increment_version_code(gradle_file_path: 'android/app/build.gradle', version_code: latest_release[:buildVersion].to_i + 1)
3639
gradle(task: 'clean', project_dir: './android/')
37-
gradle(task: 'assemble' ,build_type: 'Release', project_dir: './android')
40+
gradle(task: 'assemble', build_type: 'Release', project_dir: './android')
3841
firebase_app_distribution(
39-
app: "1:559995000649:android:828eba86aa6757c6beec98",
40-
groups: "qa-test"
41-
)
42-
git_commit(path: "./android", message: "Bump build version for Android")
43-
push_to_git_remote
44-
end
42+
app: ENV["FIREBASE_ANDROID_APP_ID"],
43+
groups: "qa-test",
44+
firebase_cli_token: ENV["FIREBASE_TOKEN"]
45+
# In your project use service_credentials_file instead of firebase_cli_token as it's a recommended solution
46+
# service_credentials_file: File.absolute_path('../firebase-service-account.json'),
47+
)
48+
end
4549

4650
desc "Android bundle release version"
47-
lane :android_release_bundle do
51+
lane :release_bundle do
4852
increment_version_code(gradle_file_path: 'android/app/build.gradle')
4953
gradle(task: 'clean', project_dir: './android/')
5054
gradle(task: 'bundle' ,build_type: 'Release', project_dir: './android')

fastlane/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ iOS deploy to TestFlight
2828

2929
## Android
3030

31-
### android android_staging
31+
### android staging
3232

3333
```sh
34-
[bundle exec] fastlane android android_staging
34+
[bundle exec] fastlane android staging
3535
```
3636

37-
Android assemble release version
37+
Android deploy to Firebase
3838

39-
### android android_release_bundle
39+
### android release_bundle
4040

4141
```sh
42-
[bundle exec] fastlane android android_release_bundle
42+
[bundle exec] fastlane android release_bundle
4343
```
4444

4545
Android bundle release version

0 commit comments

Comments
 (0)