-
Notifications
You must be signed in to change notification settings - Fork 329
/
codemagic.yaml
154 lines (154 loc) · 8.08 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
workflows:
android-workflow:
name: Android Workflow
max_build_duration: 120
environment:
groups:
# Add the group environment variables in Codemagic UI (either in Application/Team variables) - https://docs.codemagic.io/variables/environment-variable-groups/
- keystore_credentials # <-- (Includes CM_KEYSTORE, CM_KEYSTORE_PASSWORD, CM_KEY_PASSWORD, CM_KEY_ALIAS)
# CM_KEYSTORE <-- Put your keystore file here
# CM_KEYSTORE_PASSWORD <-- Put your keystore password here
# CM_KEY_PASSWORD <-- Put your keystore alias password here
# CM_KEY_ALIAS <-- Put your keystore alias username here
- google_play # <-- (Includes GCLOUD_SERVICE_ACCOUNT_CREDENTIALS - Put your google-services.json here)
- other
vars:
FCI_KEYSTORE_PATH: /tmp/keystore.keystore
PACKAGE_NAME: "io.codemagic.flutteryaml" # <-- Put your package name here
GOOGLE_PLAY_TRACK: "alpha" # <-- This must be "alpha" or above.
flutter: stable
xcode: latest
cocoapods: default
scripts:
- name: Set up key properties
script: |
echo $CM_KEYSTORE | base64 --decode > /tmp/keystore.keystore
# The following script creates key.properties file and stores the credentials in it. As we configure code signing in app/build.gradle file, the following part is unnecessary unless code signing is configured differently as explained in the documentation: https://docs.codemagic.io/flutter-code-signing/android-code-signing/
# cat >> "$CM_BUILD_DIR/android/key.properties" <<EOF
# storePassword=$FCI_KEYSTORE_PASSWORD
# keyPassword=$FCI_KEY_PASSWORD
# keyAlias=$FCI_KEY_ALIAS
# storeFile=/tmp/keystore.keystore
# EOF
- name: Set up local.properties
script: |
echo "flutter.sdk=$HOME/programs/flutter" > "$CM_BUILD_DIR/android/local.properties"
- name: Get Flutter packages
script: |
cd . && flutter packages pub get
- name: Flutter analyze
script: |
cd . && flutter analyze
- name: Flutter unit tests
script: |
cd . && flutter test
ignore_failure: true
- name: Build APK with Flutter
script: |
cd . && flutter build apk --release --build-name=1.0.0 --build-number=$(($(google-play get-latest-build-number --package-name "$PACKAGE_NAME" --tracks="$GOOGLE_PLAY_TRACK") + 1))
artifacts:
- build/**/outputs/**/*.apk
- build/**/outputs/**/*.aab
- build/**/outputs/**/mapping.txt
- flutter_drive.log
publishing:
# See the following link for details about email publishing - https://docs.codemagic.io/publishing-yaml/distribution/#email
email:
recipients:
- user_1@example.com
- user_2@example.com
notify:
success: true # To not receive a notification when a build succeeds
failure: false # To not receive a notification when a build fails
slack:
# See the following link about how to connect your Slack account - https://docs.codemagic.io/publishing-yaml/distribution/#slack
channel: '#builds'
notify_on_build_start: true # To receive a notification when a build starts
notify:
success: true # To not receive a notification when a build succeeds
failure: false # To not receive a notification when a build fails
google_play:
credentials: $GCLOUD_SERVICE_ACCOUNT_CREDENTIALS
track: $GOOGLE_PLAY_TRACK
in_app_update_priority: 0
ios-workflow:
name: iOS Workflow
# instance_type: mac_mini
max_build_duration: 120
environment:
groups:
# Add the group environment variables in Codemagic UI (either in Application/Team variables) - https://docs.codemagic.io/variables/environment-variable-groups/
- app_store_credentials # <-- (Includes APP_STORE_CONNECT_ISSUER_ID, APP_STORE_CONNECT_KEY_IDENTIFIER, APP_STORE_CONNECT_PRIVATE_KEY)
# APP_STORE_CONNECT_ISSUER_ID <-- Put your App Store Connect Issuer Id here
# APP_STORE_CONNECT_KEY_IDENTIFIER <-- Put your App Store Connect Key Identifier here
# APP_STORE_CONNECT_PRIVATE_KEY <-- Put your App Store Connect Private Key here
- certificate_credentials # <-- (Includes CERTIFICATE_PRIVATE_KEY - Put your Certificate Private Key here)
- other
vars:
XCODE_WORKSPACE: "Runner.xcworkspace"
XCODE_SCHEME: "Runner"
BUNDLE_ID: "io.codemagic.flutteryaml" # <-- Put your bundle id here
APP_STORE_ID: 1111111111 # <-- Use the TestFlight Apple id number (An automatically generated ID assigned to your app) found under General > App Information > Apple ID.
flutter: stable
xcode: latest
cocoapods: default
scripts:
- name: Set up keychain to be used for codesigning using Codemagic CLI 'keychain' command
script: |
keychain initialize
- name: Fetch signing files
script: |
app-store-connect fetch-signing-files $BUNDLE_ID --type IOS_APP_STORE --create
- name: Use system default keychain
script: |
keychain add-certificates
- name: Set up code signing settings on Xcode project
script: |
xcode-project use-profiles
- name: Get Flutter packages
script: |
cd . && flutter packages pub get
- name: Flutter analyze
script: |
cd . && flutter analyze
- name: Flutter unit tests
script: |
cd . && flutter test
ignore_failure: true
- name: Install pods
script: |
find . -name "Podfile" -execdir pod install \;
- name: Flutter build ipa and automatic versioning
script: |
flutter build ipa --release \
--build-name=1.0.0 \
--build-number=$(($(app-store-connect get-latest-testflight-build-number "$APP_STORE_ID") + 1)) \
--export-options-plist=/Users/builder/export_options.plist
artifacts:
- build/ios/ipa/*.ipa
- /tmp/xcodebuild_logs/*.log
- flutter_drive.log
publishing:
# See the following link for details about email publishing - https://docs.codemagic.io/publishing-yaml/distribution/#email
email:
recipients:
- user_1@example.com
- user_2@example.com
notify:
success: true # To receive a notification when a build succeeds
failure: false # To not receive a notification when a build fails
slack:
# See the following link about how to connect your Slack account - https://docs.codemagic.io/publishing-yaml/distribution/#slack
channel: "#builds"
notify_on_build_start: true # To receive a notification when a build starts
notify:
success: true # To receive a notification when a build succeeds
failure: false # To not receive a notification when a build fails
app_store_connect: # https://docs.codemagic.io/publishing-yaml/distribution
api_key: $APP_STORE_CONNECT_PRIVATE_KEY # Contents of the API key, can also reference environment variable such as $APP_STORE_CONNECT_PRIVATE_KEY
key_id: $APP_STORE_CONNECT_KEY_IDENTIFIER # Alphanumeric value that identifies the API key, can also reference environment variable such as $APP_STORE_CONNECT_KEY_IDENTIFIER
issuer_id: $APP_STORE_CONNECT_ISSUER_ID # Alphanumeric value that identifies who created the API key, can also reference environment variable such as $APP_STORE_CONNECT_ISSUER_ID
submit_to_testflight: false # Optional boolean, defaults to false. Whether or not to submit the uploaded build to TestFlight beta review. Required for distributing to beta groups. Note: This action is performed during post-processing.
# 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