Skip to content

Commit

Permalink
feat: [ZN-549] Android adhoc builds
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMarkiel authored Apr 25, 2024
1 parent 6b72844 commit 066629a
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 16 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/staging_build_android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Android Staging Build

# Manual deployment
on: workflow_dispatch

jobs:
build-and-publish:
runs-on: ubuntu-latest
environment: staging
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
cache: 'yarn'
node-version-file: .node-version

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17

- name: Make .env file
uses: SpicyPizza/[email protected]
with:
envkey_BASE_API_URL: ${{ vars.BASE_API_URL }}
envkey_AUTH_STORAGE_KEY: ${{ vars.AUTH_STORAGE_KEY }}
envkey_DEFAULT_LOCALE: ${{ vars.DEFAULT_LOCALE }}
envkey_MOCK_API: ${{ vars.MOCK_API }}

# Update Google Service File
# - name: Setup Firebase File
# run: echo "${{ secrets.PROD_ANDROID_FIREBASE_FILE }}" > ./android/app/google-services.json

# Setup Production Keystore file
# - name: Setup Keystore File
# run: echo "${{secrets.ANDROID_KEYSTORE_FILE}}" | base64 -d > "${{ github.workspace }}/production.keystore"

# Setup Firebase Service Account file
# - name: Setup Service Account Credential Files
# run: echo "${{secrets.FIREBASE_SERVICE_ACCOUNT_JSON}}" > "${{ github.workspace }}/firebase-service-account.json"

- name: Install
run: yarn install --frozen-lockfile

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true

- name: Setup Git Config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Build and Upload to Firebase
uses: maierj/[email protected]
with:
lane: 'android staging'
env:
# ANDROID_KEYSTORE_FILE: '${{ github.workspace }}/production.keystore'
# ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
# ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
FIREBASE_ANDROID_APP_ID: ${{ secrets.FIREBASE_ANDROID_APP_ID }}
# Not required if you define service_credentials_file in the Fastfile
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

- name: Archive build
uses: actions/upload-artifact@v4
with:
name: staging_apk
path: android/app/build/outputs/apk/**/*.apk
26 changes: 15 additions & 11 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,25 @@ end


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

desc "Android bundle release version"
lane :android_release_bundle do
lane :release_bundle do
increment_version_code(gradle_file_path: 'android/app/build.gradle')
gradle(task: 'clean', project_dir: './android/')
gradle(task: 'bundle' ,build_type: 'Release', project_dir: './android')
Expand Down
10 changes: 5 additions & 5 deletions fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ iOS deploy to TestFlight

## Android

### android android_staging
### android staging

```sh
[bundle exec] fastlane android android_staging
[bundle exec] fastlane android staging
```

Android assemble release version
Android deploy to Firebase

### android android_release_bundle
### android release_bundle

```sh
[bundle exec] fastlane android android_release_bundle
[bundle exec] fastlane android release_bundle
```

Android bundle release version
Expand Down

0 comments on commit 066629a

Please sign in to comment.