-
Notifications
You must be signed in to change notification settings - Fork 1
/
codemagic.yaml
157 lines (153 loc) · 5.36 KB
/
codemagic.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
workflows:
react-native-android:
name: React Native Android
max_build_duration: 120
instance_type: mac_mini_m1
environment:
groups:
- keystore_credentials
- google_play
vars:
PACKAGE_NAME: "io.codemagic.sample.reactnative"
scripts:
- name: Step 1
script: |
echo "export TEST1='test 1'" >> CM_ENV_VARS
- name: Step 2
script: |
source CM_ENV_VARS
echo $TEST1
- name: Step 3
script: |
echo "TEST2='test 2'" >> $CM_ENV
- name: Step 4
script: |
echo $TEST2
- name: Step 5
script: |
source CM_ENV
echo $TEST2
- name: Step 6
script: |
source $CM_ENV
echo $TEST2
- name: Set up keystore
script: |
echo $CM_KEYSTORE | base64 --decode > $CM_KEYSTORE_PATH
- name: Install npm dependencies
script: |
npm install
- name: Set Android SDK location
script: |
echo "sdk.dir=$ANDROID_SDK_ROOT" > "$FCI_BUILD_DIR/android/local.properties"
- name: Install npm dependencies
script: |
npm install
- name: Install Expo CLI and eject
script: |
npm install -g expo-cli
expo eject
- name: Set up app/build.gradle
script: |
mv ./support-files/build.gradle android/app
- name: Set Android SDK location
script: |
echo "sdk.dir=$ANDROID_SDK_ROOT" > "$FCI_BUILD_DIR/android/local.properties"
- name: Build Android release
script: |
LATEST_GOOGLE_PLAY_BUILD_NUMBER=$(google-play get-latest-build-number --package-name '$PACKAGE_NAME')
if [ -z LATEST_BUILD_NUMBER ]; then
# fallback in case no build number was found from google play. Alternatively, you can `exit 1` to fail the build
UPDATED_BUILD_NUMBER=$BUILD_NUMBER
else
UPDATED_BUILD_NUMBER=$(($LATEST_GOOGLE_PLAY_BUILD_NUMBER + 1))
fi
cd android && ./gradlew bundleRelease -PversionCode=$UPDATED_BUILD_NUMBER -PversionName=1.0.$UPDATED_BUILD_NUMBER
artifacts:
- android/app/build/outputs/**/*.aab
publishing:
email:
recipients:
- user_1@example.com
- user_2@example.com
notify:
success: true
failure: false
google_play:
credentials: $GCLOUD_SERVICE_ACCOUNT_CREDENTIALS
track: internal
submit_as_draft: true
react-native-ios:
name: React Native iOS
max_build_duration: 120
instance_type: mac_mini
environment:
groups:
- appstore_credentials
vars:
BUNDLE_ID: "io.codemagic.sample.reactnative"
XCODE_WORKSPACE: "CodemagicSample.xcworkspace" # <-- Put the name of your Xcode workspace here
XCODE_SCHEME: "CodemagicSample" # <-- Put the name of your Xcode scheme here
APP_ID: 1555555551
scripts:
- name: Install Expo CLI and eject
script: |
yarn install
yarn global add expo-cli
expo eject
- name: Set Info.plist values
script: |
PLIST=$FCI_BUILD_DIR/$XCODE_SCHEME/Info.plist
PLIST_BUDDY=/usr/libexec/PlistBuddy
$PLIST_BUDDY -c "Add :ITSAppUsesNonExemptEncryption bool false" $PLIST
- name: Install CocoaPods dependencies
script: |
cd ios && pod install
- name: Set up keychain to be used for code signing using Codemagic CLI 'keychain' command
script: keychain initialize
- name: Fetch signing files
script: |
app-store-connect fetch-signing-files "$BUNDLE_ID" \
--type IOS_APP_DEVELOPMENT \
--create
- name: Set up signing certificate
script: keychain add-certificates
- name: Set up code signing settings on Xcode project
script: xcode-project use-profiles
- name: Increment build number
script: |
#!/bin/sh
set -e
set -x
cd $FCI_BUILD_DIR
LATEST_BUILD_NUMBER=$(app-store-connect get-latest-app-store-build-number "APP_ID")
agvtool new-version -all $(($LATEST_BUILD_NUMBER + 1))
- name: Build ipa for distribution
script: |
xcode-project build-ipa --workspace "$XCODE_WORKSPACE" --scheme "$XCODE_SCHEME"
artifacts:
- build/ios/ipa/*.ipa
- /tmp/xcodebuild_logs/*.log
- $HOME/Library/Developer/Xcode/DerivedData/**/Build/**/*.app
- $HOME/Library/Developer/Xcode/DerivedData/**/Build/**/*.dSYM
publishing:
email:
recipients:
- user_1@example.com
- user_2@example.com
notify:
success: true
failure: false
app_store_connect:
api_key: $APP_STORE_CONNECT_PRIVATE_KEY
key_id: $APP_STORE_CONNECT_KEY_IDENTIFIER
issuer_id: $APP_STORE_CONNECT_ISSUER_ID
# Configuration related to TestFlight (optional)
# Note: This action is performed during post-processing.
submit_to_testflight: true
beta_groups: # Specify the names of beta tester groups that will get access to the build once it has passed beta review.
- group name 1
- group name 2
# Configuration related to App Store (optional)
# Note: This action is performed during post-processing.
submit_to_app_store: false