Skip to content

Commit d6ff9fd

Browse files
committed
build: add pipeline for building internal builds
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 34ba13c commit d6ff9fd

3 files changed

Lines changed: 129 additions & 5 deletions

File tree

.github/workflows/build-upload-android.yml renamed to .github/workflows/build-upload-android-alpha.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Android Build and Deploy
1+
name: Android Build and Deploy (Alpha)
22

33
env:
44
# The name of the main module repository
@@ -83,7 +83,7 @@ jobs:
8383
run: bundle exec fastlane android test
8484

8585
- name: Build & deploy Android release
86-
run: bundle exec fastlane android deploy
86+
run: bundle exec fastlane android deploy_alpha
8787
env:
8888
STORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
8989
KEY_ALIAS: ${{ secrets.KEY_ALIAS}}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Android Build and Deploy (Internal)
2+
3+
env:
4+
# The name of the main module repository
5+
main_project_module: app
6+
7+
# The name of the Play Store
8+
playstore_name: Code Wallet
9+
10+
on:
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
jobs:
15+
deploy:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@master
20+
21+
- name: Setup Java env
22+
uses: actions/setup-java@v3
23+
with:
24+
java-version: '17'
25+
distribution: 'corretto'
26+
cache: 'gradle'
27+
28+
- name: Setup Ruby env
29+
uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: 2.7.2
32+
bundler-cache: true
33+
34+
- name: Decode Google Services JSON file
35+
uses: timheuer/base64-to-file@v1
36+
id: google_services_json_file
37+
with:
38+
fileName: google-services.json
39+
fileDir: ./app/src
40+
encodedString: ${{ secrets.GOOGLE_SERVICES_JSON }}
41+
42+
- name: Decode Service Account Key JSON file
43+
uses: timheuer/base64-to-file@v1
44+
id: service_account_json_file
45+
with:
46+
fileName: serviceAccount.json
47+
encodedString: ${{ secrets.SERVICE_ACCOUNT_KEY_JSON }}
48+
49+
- name: Decode Upload Key Store file into location 1
50+
uses: timheuer/base64-to-file@v1
51+
with:
52+
fileName: key
53+
fileDir: ./key
54+
encodedString: ${{ secrets.UPLOAD_KEY_STORE }}
55+
56+
- name: Decode Upload Key Store file into location 2
57+
uses: timheuer/base64-to-file@v1
58+
with:
59+
fileName: key
60+
fileDir: ./app/key
61+
encodedString: ${{ secrets.UPLOAD_KEY_STORE }}
62+
63+
- name: Setup BugSnag API Key
64+
run: echo BUGSNAG_API_KEY=\"${{ secrets.BUGSNAG_API_KEY }}\" > ./local.properties
65+
66+
- name: Setup Fingerprint API Key
67+
run: echo FINGERPRINT_API_KEY=${{ secrets.FINGERPRINT_API_KEY }} >> ./local.properties
68+
69+
- name: Setup Google Cloud Project Number
70+
run: echo GOOGLE_CLOUD_PROJECT_NUMBER=${{ secrets.GOOGLE_CLOUD_PROJECT_NUMBER }} >> ./local.properties
71+
72+
- name: Setup Kado API Key
73+
run: echo KADO_API_KEY=\"${{ secrets.KADO_API_KEY }}\" >> ./local.properties
74+
75+
- name: Setup Mixpanel API Key
76+
run: echo MIXPANEL_API_KEY=\"${{ secrets.MIXPANEL_API_KEY }}\" >> ./local.properties
77+
78+
- name: Run tests
79+
run: bundle exec fastlane android test
80+
81+
- name: Build & deploy Android release
82+
run: bundle exec fastlane android deploy_internal
83+
env:
84+
STORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
85+
KEY_ALIAS: ${{ secrets.KEY_ALIAS}}
86+
KEY_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
87+
SERVICE_ACCOUNT_KEY_JSON: ${{ steps.service_account_json_file.outputs.filePath }}
88+
89+
- name: Upload build artifacts
90+
uses: actions/upload-artifact@v2
91+
with:
92+
name: assets
93+
path: |
94+
${{ github.workspace }}/app/build/outputs/bundle/release

fastlane/Fastfile

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ platform :android do
2121
gradle(task: "test")
2222
end
2323

24-
desc "Build and Deploy a new version to the Google Play"
25-
lane :deploy do
24+
desc "Build and Deploy a new alpha version to the Google Play"
25+
lane :deploy_alpha do
2626
#puts "Patch version for this build will be " + ENV["BUILD_NUMBER"]
2727
gradle(
2828
task: "clean bundle", #"clean app:bundleRelease",
@@ -41,7 +41,7 @@ platform :android do
4141
)
4242

4343
upload_to_play_store(
44-
track: "internal",
44+
track: "alpha",
4545
aab: Actions.lane_context[SharedValues::GRADLE_AAB_OUTPUT_PATH],
4646
skip_upload_apk: true,
4747
skip_upload_changelogs: true,
@@ -50,4 +50,34 @@ platform :android do
5050
# mapping: mapping_file_exists() ? Actions.lane_context[SharedValues::GRADLE_MAPPING_TXT_OUTPUT_PATH] : nil
5151
)
5252
end
53+
54+
desc "Build and Deploy a new internal version to the Google Play"
55+
lane :deploy_internal do
56+
#puts "Patch version for this build will be " + ENV["BUILD_NUMBER"]
57+
gradle(
58+
task: "clean bundle", #"clean app:bundleRelease",
59+
build_type: "release",
60+
properties: {
61+
#"versionPatch" => ENV["BUILD_NUMBER"],
62+
"android.injected.signing.store.file" => "key/key",
63+
"android.injected.signing.store.password" => ENV["STORE_PASSWORD"],
64+
"android.injected.signing.key.alias" => ENV["KEY_ALIAS"],
65+
"android.injected.signing.key.password" => ENV["KEY_PASSWORD"]
66+
}
67+
)
68+
69+
validate_play_store_json_key(
70+
json_key: ENV["SERVICE_ACCOUNT_KEY_JSON"]
71+
)
72+
73+
upload_to_play_store(
74+
track: "internal",
75+
aab: Actions.lane_context[SharedValues::GRADLE_AAB_OUTPUT_PATH],
76+
skip_upload_apk: true,
77+
skip_upload_changelogs: true,
78+
skip_upload_images: true,
79+
mapping: Actions.lane_context[SharedValues::GRADLE_MAPPING_TXT_OUTPUT_PATH]
80+
# mapping: mapping_file_exists() ? Actions.lane_context[SharedValues::GRADLE_MAPPING_TXT_OUTPUT_PATH] : nil
81+
)
82+
end
5383
end

0 commit comments

Comments
 (0)