Skip to content

Commit

Permalink
Merge pull request #186 from kosukesaigusa/release_to_dev
Browse files Browse the repository at this point in the history
Release to dev
  • Loading branch information
kosukesaigusa committed Sep 8, 2023
2 parents ed067ab + f73c1f6 commit c067b08
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 17 deletions.
90 changes: 80 additions & 10 deletions .github/workflows/release_to_dev.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Flutter CI/CD
name: Release to Dev

on:
push:
Expand All @@ -10,7 +10,7 @@ jobs:
runs-on: macOS-latest

steps:
- name: Checkout Repository
- name: Checkout repository
uses: actions/checkout@v2

- name: Read Flutter SDK version
Expand All @@ -31,30 +31,100 @@ jobs:
- name: flutter pub get (mottai_flutter_app)
run: cd packages/mottai_flutter_app && flutter pub get

- name: Flutter Build IPA
- name: Create dev-dart-define.json from GitHub secret
run: |
cd packages/mottai_flutter_app
echo '${{ secrets.DEV_DART_DEFINE_JSON_STRING }}' > 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/
- 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="dart_defines/dev-dart-define.json" \
--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: Validate IPA
- 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 "./packages/mottai_flutter_app/build/ios/ipa/mottai_dev.ipa" \
-f "./build/ios/ipa/mottai_dev.ipa" \
-t ios \
--apiKey ${{ secrets.DEV_IOS_API_KEY }} \
--apiIssuer ${{ secrets.DEV_IOS_API_ISSUER }} \
--private-key ${{ secrets.DEV_IOS_AUTH_KEY }}
--private-key "./private_keys/AuthKey_${{ secrets.DEV_IOS_API_KEY }}.p8"
- name: Upload IPA to TestFlight
- name: Upload ipa to TestFlight
run: |
cd packages/mottai_flutter_app
xcrun altool --upload-app \
-f "./packages/mottai_flutter_app/build/ios/ipa/mottai_dev.ipa" \
-f "./build/ios/ipa/mottai_dev.ipa" \
-t ios \
--apiKey ${{ secrets.DEV_IOS_API_KEY }} \
--apiIssuer ${{ secrets.DEV_IOS_API_ISSUER }} \
--private-key ${{ secrets.DEV_IOS_AUTH_KEY }}
--private-key "./private_keys/AuthKey_${{ secrets.DEV_IOS_API_KEY }}.p8"
10 changes: 9 additions & 1 deletion packages/mottai_flutter_app/ios/ExportOptions.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@
<string>export</string>
<key>method</key>
<string>app-store</string>
<key>provisioningProfiles</key>
<dict>
<!-- Provisioning Profile の中身を確認して App ID と名前を指定する必要がある -->
<key>com.kosukesaigusa.mottaiFlutterApp.dev</key>
<string>Mottai Flutter App Dev</string>
</dict>
<key>signingCertificate</key>
<string>Apple Distribution</string>
<key>signingStyle</key>
<string>automatic</string>
<string>manual</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
Expand Down
1 change: 1 addition & 0 deletions packages/mottai_flutter_app/ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
#include "DartDefines.xcconfig"
1 change: 1 addition & 0 deletions packages/mottai_flutter_app/ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
#include "DartDefines.xcconfig"
14 changes: 13 additions & 1 deletion packages/mottai_flutter_app/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-$(flavor)";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = M92JZ2K56V;
ENABLE_BITCODE = NO;
Expand All @@ -416,6 +418,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "com.kosukesaigusa.mottaiFlutterApp$(appIdSuffix)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -536,6 +539,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-$(flavor)";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = M92JZ2K56V;
ENABLE_BITCODE = NO;
Expand All @@ -546,6 +551,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "com.kosukesaigusa.mottaiFlutterApp$(appIdSuffix)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand All @@ -560,8 +566,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-$(flavor)";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = M92JZ2K56V;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = M92JZ2K56V;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -570,6 +580,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "com.kosukesaigusa.mottaiFlutterApp$(appIdSuffix)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Mottai Flutter App Dev";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
Expand Down
10 changes: 5 additions & 5 deletions packages/mottai_flutter_app/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
Expand All @@ -45,13 +47,11 @@
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>プロフィール画像などを撮影するために端末のカメラを使用します。</string>
<string>プロフィール画像や投稿する写真などを撮影するために端末のカメラを使用します。</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>プロフィール画像や投稿する写真などを選択するために端末の画像ライブラリを使用します。</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>現在地を取得するため位置情報サービスを使用します。</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app requires to add file to your photo library your microphone</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>プロフィール画像などを選択するために端末の画像ライブラリを使用します。</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
Expand Down

0 comments on commit c067b08

Please sign in to comment.