forked from BinaryStudioAcademy/bsa-2022-vse-bude
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodemagic.yaml
137 lines (118 loc) · 3.47 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
scripts:
- &npm_install
name: Install npm dependencies
working_directory: $CM_BUILD_DIR
script: |
npm install && npm run install:shared && npm run build:shared && npm run install:mobile
- &environment_set
name: Setting environment file
script: |
cat >> ".env" <<EOF
API_ORIGIN_URL=$API_ORIGIN_URL
EOF
- &android_sdk_set
name: Set Android SDK location
script: |
echo "sdk.dir=$ANDROID_SDK_ROOT" > "./android/local.properties"
- &android_keystore_set
name: Set up keystore
script: |
echo $KEYSTORE | base64 --decode > $KEYSTORE_STORE_PATH
cat >> "./android/keystore.properties" <<EOF
storePassword=$KEYSTORE_STORE_PASSWORD
keyPassword=$KEYSTORE_KEY_PASSWORD
keyAlias=$KEYSTORE_KEY_ALIAS
storeFile=$KEYSTORE_STORE_PATH
EOF
- &android_google_services_set
name: Set google services
script: |
echo $GOOGLE_SERVICES_JSON_BASE64 | base64 --decode > ./android/app/google-services.json
- &android_build_apk
name: Build Android release
script: |
export INCREMENTED_GOOGLE_PLAY_BUILD_NUMBER=$(($(google-play get-latest-build-number --package-name "$PACKAGE_NAME" --tracks=internal) + 1))
cd ./android && ./gradlew clean assembleRelease
- &android_build_aab
name: Build Android release
script: |
export INCREMENTED_GOOGLE_PLAY_BUILD_NUMBER=$(($(google-play get-latest-build-number --package-name "$PACKAGE_NAME" --tracks=internal) + 1))
cd ./android && ./gradlew clean bundleRelease
workflows:
# MAIN
android-main:
name: Android Main
working_directory: packages/mobile
max_build_duration: 60
instance_type: mac_mini
environment:
groups:
- env_main
- android_keystore
node: 16
cache:
cache_paths:
- $CM_BUILD_DIR/node_modules
- $CM_BUILD_DIR/packages/shared/node_modules
- $CM_BUILD_DIR/packages/mobile/node_modules
scripts:
- *npm_install
- *environment_set
- *android_sdk_set
- *android_keystore_set
- *android_google_services_set
- *android_build_apk
artifacts:
- $CM_BUILD_DIR/packages/mobile/android/app/build/outputs/**/*.apk
publishing:
email:
recipients:
notify:
success: true
failure: false
# Play Console
android-play-console:
name: Android Play Console
working_directory: packages/mobile
max_build_duration: 60
instance_type: mac_mini
environment:
groups:
- env_main
- android_keystore
- play_console
node: 16
triggering:
events:
- push
branch_patterns:
- pattern: main
include: true
source: false
cancel_previous_builds: true
when:
changeset:
includes:
- 'packages/mobile/'
scripts:
- *npm_install
- *environment_set
- *android_sdk_set
- *android_keystore_set
- *android_google_services_set
- *android_build_aab
artifacts:
- $CM_BUILD_DIR/packages/mobile/android/app/build/outputs/**/*.aab
publishing:
email:
recipients:
notify:
success: true
failure: false
google_play:
credentials: $GCLOUD_SERVICE_ACCOUNT_CREDENTIALS
track: internal
submit_as_draft: true