Skip to content

Commit 097d034

Browse files
Merge pull request #663 from GetStream/automated-deploys
Setup automated tesflight/s3 deployments
2 parents 8f5e7d3 + 79b1c79 commit 097d034

File tree

11 files changed

+165
-22
lines changed

11 files changed

+165
-22
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
name: build
22

33
on:
4-
push:
4+
pull_request:
55
branches:
66
- master
7+
types: [closed]
78
jobs:
8-
build_and_deploy_ios:
9+
build_and_deploy_ios_testflight_qa:
10+
if: ${{ github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'deploy') }}
911
runs-on: [macos-latest]
1012
steps:
1113
- uses: actions/checkout@v2
1214
- name: Install RubyGems
1315
run: |
1416
cd examples/SampleApp/ios
1517
bundle update --bundler
16-
- name: Install firebase-tools
17-
run: npm install -g firebase-tools
1818
- name: RN setup
1919
run: |
2020
yarn;
@@ -24,16 +24,19 @@ jobs:
2424
yarn;
2525
cd ios
2626
pod install
27-
- name: Build and release
27+
- name: Build and release Testflight QA
2828
env:
2929
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
3030
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
31-
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
31+
APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY_ID }}
32+
APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }}
33+
APP_STORE_CONNECT_API_KEY_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY }}
3234
run: |
3335
cd examples/SampleApp/ios
34-
bundle exec fastlane distribute
36+
bundle exec fastlane deploy_to_testflight_qa
3537
36-
build_and_deploy_android:
38+
build_and_deploy_android_s3:
39+
if: ${{ github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'deploy') }}
3740
runs-on: ubuntu-latest
3841
steps:
3942
- uses: actions/checkout@v2
@@ -56,10 +59,14 @@ jobs:
5659
yarn react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest tmp
5760
cd android
5861
rm -rf $HOME/.gradle/caches/ && ./gradlew assembleRelease
59-
- name: Deploy
60-
uses: wzieba/[email protected]
62+
63+
- name: Configure AWS credentials
64+
uses: aws-actions/configure-aws-credentials@v1
6165
with:
62-
appId: ${{secrets.ANDROID_FIREBASE_APP_ID}}
63-
token: ${{secrets.FIREBASE_TOKEN}}
64-
groups: android-react-native-testers
65-
file: examples/SampleApp/android/app/build/outputs/apk/release/app-release.apk
66+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
67+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
68+
aws-region: us-east-1
69+
- name: Upload APK
70+
run: |
71+
cp examples/SampleApp/android/app/build/outputs/apk/release/app-release.apk rn-sample-app.apk
72+
aws s3 cp rn-sample-app.apk s3://${{ secrets.AWS_S3_BUCKET }} --sse AES256

.github/workflows/legacy-build.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
jobs:
8+
build_and_deploy_ios_firebase:
9+
runs-on: [macos-latest]
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Install RubyGems
13+
run: |
14+
cd examples/SampleApp/ios
15+
bundle update --bundler
16+
- name: Install firebase-tools
17+
run: npm install -g firebase-tools
18+
- name: RN setup
19+
run: |
20+
yarn;
21+
cd native-package
22+
yarn;
23+
cd ../examples/SampleApp
24+
yarn;
25+
cd ios
26+
pod install
27+
- name: Build and release Firebase
28+
env:
29+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
30+
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
31+
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
32+
run: |
33+
cd examples/SampleApp/ios
34+
bundle exec fastlane deploy_to_firebase
35+
36+
build_and_deploy_android_firebase:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v2
40+
- uses: actions/setup-java@v1
41+
with:
42+
java-version: 1.8
43+
- name: RN setup
44+
run: |
45+
yarn add global react-native-cli;
46+
yarn;
47+
cd native-package
48+
yarn;
49+
cd ../examples/SampleApp
50+
yarn;
51+
- name: Build
52+
run: |
53+
cd examples/SampleApp
54+
mkdir android/app/src/main/assets
55+
mkdir tmp
56+
yarn react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest tmp
57+
cd android
58+
rm -rf $HOME/.gradle/caches/ && ./gradlew assembleRelease
59+
- name: Deploy
60+
uses: wzieba/[email protected]
61+
with:
62+
appId: ${{secrets.ANDROID_FIREBASE_APP_ID}}
63+
token: ${{secrets.FIREBASE_TOKEN}}
64+
groups: android-react-native-testers
65+
file: examples/SampleApp/android/app/build/outputs/apk/release/app-release.apk

examples/SampleApp/ios/Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ GEM
8282
xcpretty (~> 0.3.0)
8383
xcpretty-travis-formatter (>= 0.0.3)
8484
fastlane-plugin-firebase_app_distribution (0.2.4)
85+
fastlane-plugin-load_json (0.0.1)
8586
gh_inspector (1.1.3)
8687
google-api-client (0.38.0)
8788
addressable (~> 2.5, >= 2.5.1)
@@ -177,6 +178,7 @@ PLATFORMS
177178
DEPENDENCIES
178179
fastlane
179180
fastlane-plugin-firebase_app_distribution
181+
fastlane-plugin-load_json
180182

181183
BUNDLED WITH
182184
2.1.4

examples/SampleApp/ios/SampleApp-tvOS/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>22</string>
22+
<string>24</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true />
2525
<key>NSAppTransportSecurity</key>

examples/SampleApp/ios/SampleApp-tvOSTests/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>22</string>
22+
<string>24</string>
2323
</dict>
2424
</plist>

examples/SampleApp/ios/SampleApp.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@
672672
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
673673
CLANG_ENABLE_MODULES = YES;
674674
CODE_SIGN_IDENTITY = "iPhone Distribution";
675-
CURRENT_PROJECT_VERSION = 22;
675+
CURRENT_PROJECT_VERSION = 24;
676676
DEVELOPMENT_TEAM = EHV7XZLAHA;
677677
ENABLE_BITCODE = NO;
678678
INFOPLIST_FILE = SampleApp/Info.plist;
@@ -699,7 +699,7 @@
699699
CLANG_ENABLE_MODULES = YES;
700700
CODE_SIGN_IDENTITY = "iPhone Distribution";
701701
CODE_SIGN_STYLE = Manual;
702-
CURRENT_PROJECT_VERSION = 22;
702+
CURRENT_PROJECT_VERSION = 24;
703703
DEVELOPMENT_TEAM = EHV7XZLAHA;
704704
INFOPLIST_FILE = SampleApp/Info.plist;
705705
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";

examples/SampleApp/ios/SampleApp/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>22</string>
24+
<string>24</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true />
2727
<key>NSAppTransportSecurity</key>

examples/SampleApp/ios/SampleAppTests/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>22</string>
22+
<string>24</string>
2323
</dict>
2424
</plist>

examples/SampleApp/ios/fastlane/Fastfile

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,20 @@ lane :match_me do
3434
)
3535
end
3636

37+
desc "Installs all Certs and Profiles necessary for appstore"
38+
lane :match_appstore do
39+
match(
40+
type: "appstore",
41+
app_identifier: [
42+
"io.getstream.reactnative.SampleApp",
43+
],
44+
readonly: is_ci
45+
)
46+
end
47+
3748
platform :ios do
38-
desc "Description of what the lane does"
39-
lane :distribute do
49+
desc "Deploy build to Firebase"
50+
lane :deploy_to_firebase do
4051
match_me
4152

4253
gym(
@@ -58,3 +69,47 @@ platform :ios do
5869
)
5970
end
6071
end
72+
73+
platform :ios do
74+
desc "Deploy build to TestFlight QA"
75+
lane :deploy_to_testflight_qa do
76+
app_store_connect_api_key()
77+
78+
match_appstore
79+
80+
settings_to_override = {
81+
:BUNDLE_IDENTIFIER => "io.getstream.reactnative.SampleApp",
82+
:PROVISIONING_PROFILE_SPECIFIER => "match AppStore io.getstream.reactnative.SampleApp"
83+
}
84+
85+
package = load_json(json_path: "../package.json")
86+
increment_version_number(version_number: package["version"])
87+
increment_build_number(xcodeproj: "SampleApp.xcodeproj")
88+
89+
gym(
90+
workspace: "./SampleApp.xcworkspace",
91+
scheme: "SampleApp",
92+
export_method: "app-store",
93+
export_options: "./fastlane/testflight_gym_export_options.plist",
94+
silent: true,
95+
clean: true,
96+
xcargs: settings_to_override,
97+
include_symbols: true,
98+
output_directory: "./dist",
99+
)
100+
101+
upload_to_testflight(
102+
groups: ['Testers'],
103+
changelog: "Lots of amazing new features to test out!",
104+
reject_build_waiting_for_review: true
105+
)
106+
107+
commit_version_bump(
108+
message: "[fastlane][ios] Bump version [skip ci]",
109+
xcodeproj: "SampleApp.xcodeproj",
110+
force: true # otherwise untracked files may crash the CI build
111+
)
112+
113+
push_to_git_remote()
114+
end
115+
end

examples/SampleApp/ios/fastlane/Pluginfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
# Ensure this file is checked in to source control!
44

55
gem 'fastlane-plugin-firebase_app_distribution'
6+
gem 'fastlane-plugin-load_json'

0 commit comments

Comments
 (0)