-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodemagic.yaml
176 lines (163 loc) · 5.29 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
workflows:
android-release-workflow:
name: DogSportsDiary Android Workflow
max_build_duration: 60
instance_type: mac_mini_m1
# triggering:
# events: # List the events that trigger builds
# - tag
# branch_patterns: # Include or exclude watched branches
# - pattern: 'master'
# include: true
# source: true
environment:
android_signing:
- dogsportsdiary_signature
#- keystore_reference
groups:
- google_credentials
- github_credentials
vars:
PACKAGE_NAME: "io.github.maocypher.dogsportsdiary"
GOOGLE_PLAY_TRACK: alpha
flutter: stable
scripts:
- name: Set up local.properties
script: |
echo "flutter.sdk=$HOME/programs/flutter" > "$CM_BUILD_DIR/android/local.properties"
- name: Get Flutter packages
script: |
flutter packages pub get
- name: Flutter analyze
script: |
flutter analyze --no-fatal-infos --no-fatal-warnings
- name: Flutter unit tests
script: |
flutter test
ignore_failure: false
#- name: Build AAB with Flutter
# script: |
# flutter build appbundle --release \
# --build-name=1.0.$PROJECT_BUILD_NUMBER \
# --build-number=$PROJECT_BUILD_NUMBER
# - name: Build AAB with Flutter
# script: |
# BUILD_NUMBER=$(($(google-play get-latest-build-number --package-name "$PACKAGE_NAME") + 1))
# flutter build appbundle --release \
# --build-name=1.0.$BUILD_NUMBER \
# --build-number=$BUILD_NUMBER
- name: Zip source code
script: |
VERSION=$(grep 'version:' pubspec.yaml | awk '{print $2}')
BUILD_NAME=$(echo $VERSION | cut -d+ -f1)
zip -r ${BUILD_NAME}.zip .
tar -czvf ${BUILD_NAME}.tar.gz .
- name: Build APK with Flutter
script: |
VERSION=$(grep 'version:' pubspec.yaml | awk '{print $2}')
BUILD_NAME=$(echo $VERSION | cut -d+ -f1)
BUILD_NUMBER=$(echo $VERSION | cut -d+ -f2)
flutter build apk --release \
--build-name=$BUILD_NAME \
--build-number=$BUILD_NUMBER
- name: Publish to GitHub
script: |
#!/usr/bin/env zsh
# Publish only for tag builds
if [ -z ${CM_TAG} ]; then
echo "Not a tag build, will not publish GitHub release"
exit 0
fi
gh release create "${CM_TAG}" \
--title "v${CM_TAG}" \
--notes-file changelog.md \
build/**/outputs/**/*.aab \
build/**/outputs/**/*.apk \
${CM_TAG}.zip \
${CM_TAG}.tar.gz
artifacts:
- build/**/outputs/**/*.apk
- build/**/outputs/**/*.aab
- build/**/outputs/**/mapping.txt
- flutter_drive.log
publishing:
email:
recipients:
- maocypher@gmail.com
notify:
success: true
failure: true
#google_play:
# credentials: $GCLOUD_SERVICE_ACCOUNT_CREDENTIALS
# track: $GOOGLE_PLAY_TRACK
# submit_as_draft: true
ios-workflow:
name: DogSportsDiary iOS Workflow
max_build_duration: 60
instance_type: mac_mini_m1
# triggering:
# events: # List the events that trigger builds
# - tag
# branch_patterns: # Include or exclude watched branches
# - pattern: 'master'
# include: true
# source: true
environment:
#ios_signing:
# distribution_type: app_store
# bundle_identifier: io.codemagic.fluttersample
vars:
PACKAGE_NAME: "io.github.maocypher.dogsportsdiary"
APP_STORE_APPLE_ID: 1555555551
flutter: stable
scripts:
- name: Set up code signing settings on Xcode project
script: |
xcode-project use-profiles
- name: Get Flutter packages
script: |
flutter packages pub get
- name: Install pods
script: |
find . -name "Podfile" -execdir pod install \;
- name: Flutter analyze
script: |
flutter analyze --no-fatal-infos --no-fatal-warnings
- name: Flutter unit tests
script: |
flutter test
ignore_failure: false
#- name: Flutter build ipa
# script: |
# flutter build ipa --release \
# --build-name=1.0.0 \
# --export-options-plist=/Users/builder/export_options.plist
- name: Flutter build simulator debug version
script: |
flutter build ios --debug --no-codesign \
--simulator \
--build-name=1.0.0
- name: Rename the simulator file
script: |
mv build/ios/iphonesimulator/Runner.app \
build/ios/iphonesimulator/Runner-debug-simulator.app
- name: Flutter build real device debug version
script: |
flutter build ios --debug --no-codesign \
--build-name=1.0.0
- name: Rename the device file
script: |
mv build/ios/iphoneos/Runner.app \
build/ios/iphoneos/Runner-debug.app
artifacts:
- build/ios/ipa/*.ipa
- build/ios/*/*.app
- /tmp/xcodebuild_logs/*.log
- flutter_drive.log
publishing:
email:
recipients:
- maocypher@gmail.com
notify:
success: true
failure: true