-
Notifications
You must be signed in to change notification settings - Fork 4
208 lines (169 loc) · 8.35 KB
/
release_to_dev.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Release to Dev
on:
push:
branches:
- release_to_dev
jobs:
release-android-to-dev-firebase:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Firebase CLI
run: npm install -g firebase-tools
- name: Read Flutter SDK version
run: echo "FLUTTER_VERSION=$(jq -r '.flutterSdkVersion' .fvm/fvm_config.json)" >> $GITHUB_ENV
shell: bash
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: flutter pub get (dart_flutter_common)
run: cd packages/dart_flutter_common && flutter pub get
- name: flutter pub get (firebase_common)
run: cd packages/firebase_common && flutter pub get
- name: flutter pub get (mottai_flutter_app)
run: cd packages/mottai_flutter_app && flutter pub get
- name: Create dev-dart-define.json from GitHub secret
run: echo '${{ secrets.DEV_DART_DEFINE_JSON_STRING }}' > packages/mottai_flutter_app/dev-dart-define.json
- name: Create secret.properties
run: |
echo "googleMap.apiKey=${{ secrets.DEV_GOOGLE_MAP_API_KEY }}" > packages/mottai_flutter_app/android/secret.properties
- name: Create keystore.properties
run: |
echo '${{ secrets.KEYSTORE_PROPERTIES }}' > packages/mottai_flutter_app/android/keystore.properties
- name: Decode release.jks from GitHub secrets
run: echo "${{ secrets.RELEASE_JKS_BASE64_STRING }}" | base64 --decode > packages/mottai_flutter_app/android/app/release.jks
- name: flutter build appbundle
run: |
cd packages/mottai_flutter_app
flutter build appbundle --release \
--dart-define-from-file="dev-dart-define.json" \
-t "lib/main.dart" \
--build-name=$(grep 'version:' pubspec.yaml | cut -d ' ' -f 2 | cut -d '+' -f 1) \
--build-number=$GITHUB_RUN_NUMBER
- name: Get latest 10 commit messages
run: echo "LATEST_COMMIT_MESSAGES=$(git log -n 10 --pretty=format:'%s' | tr '\n' '; ')" >> $GITHUB_ENV
- name: Deploy to Firebase
env:
DEV_FIREBASE_SERVICE_ACCOUNT_KEY_BASE64: ${{ secrets.DEV_FIREBASE_SERVICE_ACCOUNT_KEY_BASE64 }}
run: |
echo $DEV_FIREBASE_SERVICE_ACCOUNT_KEY_BASE64 | base64 -d > /tmp/dev_firebase_service_account_key.json
export GOOGLE_APPLICATION_CREDENTIALS=/tmp/dev_firebase_service_account_key.json
firebase use dev
firebase appdistribution:distribute packages/mottai_flutter_app/build/app/outputs/bundle/release/app-release.aab \
--app ${{ secrets.DEV_FIREBASE_ANDROID_APP_ID }} \
--groups internal-testers \
--release-notes "${LATEST_COMMIT_MESSAGES}"
- name: Create service_account.json
run: echo "${{ secrets.GPC_API_KEY_BASE64 }}" | base64 --decode > service_account.json
- name: Upload to GPC
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJson: service_account.json
packageName: com.kosukesaigusa.mottai_flutter_app.dev2
releaseFiles: packages/mottai_flutter_app/build/app/outputs/bundle/release/app-release.aab
track: internal
release-ios-to-dev-testflight:
runs-on: macOS-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Read Flutter SDK version
run: echo "FLUTTER_VERSION=$(jq -r '.flutterSdkVersion' .fvm/fvm_config.json)" >> $GITHUB_ENV
shell: bash
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: flutter pub get (dart_flutter_common)
run: cd packages/dart_flutter_common && flutter pub get
- name: flutter pub get (firebase_common)
run: cd packages/firebase_common && flutter pub get
- name: flutter pub get (mottai_flutter_app)
run: cd packages/mottai_flutter_app && flutter pub get
- name: Create dev-dart-define.json from GitHub secret
run: echo '${{ secrets.DEV_DART_DEFINE_JSON_STRING }}' > packages/mottai_flutter_app/dev-dart-define.json
- name: Prepare Xcode build settings
run: |
# dev-dart-define.json から各値を読み込む
cd packages/mottai_flutter_app
FLAVOR=$(jq -r '.flavor' dev-dart-define.json)
APP_NAME=$(jq -r '.appName' dev-dart-define.json)
APP_ID_SUFFIX=$(jq -r '.appIdSuffix' dev-dart-define.json)
# DartDefines.xcconfig ファイルに書き込む
echo "flavor = dev" > DartDefines.xcconfig
echo "appName = mottai_dev" >> DartDefines.xcconfig
echo "appIdSuffix = .dev" >> DartDefines.xcconfig
# このファイルを Xcode が参照できるように ios ディレクトリに移動する
mv DartDefines.xcconfig ios/
# ios/Flutter/Release.xcconfig ファイルに追記する
echo '#include "DartDefines.xcconfig"' >> ios/Flutter/Release.xcconfig
- name: Decode and install provisioning profile
run: |
echo ${{ secrets.DEV_APPLE_DISTRIBUTION_PROVISIONING_PROFILE_BASE64_STRING }} | base64 --decode > profile.mobileprovision
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp profile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/
- name: Run import-codesign-certs
uses: Apple-Actions/import-codesign-certs@v2
with:
p12-file-base64: ${{ secrets.DEV_APPLE_DISTRIBUTION_CERTIFICATE_P12_BASE64_STRING }}
p12-password: ${{ secrets.DEV_APPLE_DISTRIBUTION_CERTIFICATE_P12_PASSWORD }}
- name: Prepare Xcode build settings for Distribution
run: |
# 適切なプロビジョニングプロファイルの名前を指定する
echo "PROVISIONING_PROFILE_SPECIFIER = Mottai Flutter App Dev" >> DartDefines.xcconfig
# 手動署名を選択する
echo "CODE_SIGN_STYLE = Manual" >> DartDefines.xcconfig
- name: Create Environment.swift
run: |
echo "import Foundation" > packages/mottai_flutter_app/ios/Runner/Environment.swift
echo "struct Env {" >> packages/mottai_flutter_app/ios/Runner/Environment.swift
echo " static let googleMapApiKey = \"${{ secrets.DEV_GOOGLE_MAP_API_KEY }}\"" >> packages/mottai_flutter_app/ios/Runner/Environment.swift
echo "}" >> packages/mottai_flutter_app/ios/Runner/Environment.swift
- name: flutter build ipa
run: |
cd packages/mottai_flutter_app
flutter build ipa --release \
--dart-define-from-file="dev-dart-define.json" \
-t "lib/main.dart" \
--build-name=$(grep 'version:' pubspec.yaml | cut -d ' ' -f 2 | cut -d '+' -f 1) \
--build-number=$GITHUB_RUN_NUMBER \
--export-options-plist="ios/ExportOptions.plist"
- name: Detect ipa file path
run: |
cd packages/mottai_flutter_app
if [ ! -d "build/ios/ipa" ]; then
echo "build/ios/ipa directory does not exist."
exit 1
fi
IPA_PATH=$(find build/ios/ipa -type f -name '*.ipa')
if [ -z "$IPA_PATH" ]; then
echo "No .ipa file found."
exit 1
fi
echo "IPA_PATH=$IPA_PATH" >> $GITHUB_ENV
echo $IPA_PATH
- name: Save AuthKey_${DEV_IOS_API_KEY}.p8 file
run: |
cd packages/mottai_flutter_app
mkdir private_keys
echo "${{ secrets.DEV_IOS_AUTH_KEY }}" > private_keys/AuthKey_${{ secrets.DEV_IOS_API_KEY }}.p8
- name: Validate ipa
run: |
cd packages/mottai_flutter_app
xcrun altool --validate-app \
-f $IPA_PATH \
-t ios \
--apiKey ${{ secrets.DEV_IOS_API_KEY }} \
--apiIssuer ${{ secrets.DEV_IOS_API_ISSUER }} \
--private-key "./private_keys/AuthKey_${{ secrets.DEV_IOS_API_KEY }}.p8"
- name: Upload ipa to TestFlight
run: |
cd packages/mottai_flutter_app
xcrun altool --upload-app \
-f $IPA_PATH \
-t ios \
--apiKey ${{ secrets.DEV_IOS_API_KEY }} \
--apiIssuer ${{ secrets.DEV_IOS_API_ISSUER }} \
--private-key "./private_keys/AuthKey_${{ secrets.DEV_IOS_API_KEY }}.p8"