1
- name : Flutter iOS Build
1
+ name : Build iOS App
2
2
3
3
on :
4
4
push :
7
7
pull_request :
8
8
branches :
9
9
- main
10
+ workflow_dispatch :
10
11
11
12
jobs :
12
- build_ios :
13
+ build :
14
+ name : Build iOS App
13
15
runs-on : macos-latest
14
-
15
16
steps :
16
- # 1. Checkout the repository
17
- - name : Checkout repository
18
- uses : actions/checkout@v3
19
-
20
- # 2. Install Flutter with subosito/flutter-action@v2
21
- - name : Install Flutter
22
- uses : subosito/flutter-action@v2
23
-
24
- # 3. Install dependencies
25
- - name : Install dependencies
26
- run : flutter pub get
27
-
28
- # 4. Set up iOS Signing Keychain and Certificates
29
- - name : Set up iOS Signing Keychain and Certificates
30
- env :
31
- IOS_CERTIFICATE_P12 : ${{ secrets.IOS_CERTIFICATE_P12 }}
32
- IOS_CERTIFICATE_PASSWORD : ${{ secrets.IOS_CERTIFICATE_PASSWORD }}
33
- IOS_PROVISIONING_PROFILE : ${{ secrets.IOS_PROVISIONING_PROFILE }}
34
- run : |
35
- # Create a custom keychain
36
- security create-keychain -p "github-actions" ios-build.keychain
37
- security default-keychain -s ios-build.keychain
38
- security unlock-keychain -p "github-actions" ios-build.keychain
17
+ - name : Checkout Repository
18
+ uses : actions/checkout@v4
39
19
40
- # Import the certificate (.p12)
41
- echo $IOS_CERTIFICATE_P12 | base64 --decode > ios_certificate.p12
42
- security import ios_certificate.p12 -k ios-build.keychain -P $IOS_CERTIFICATE_PASSWORD -T /usr/bin/codesign
20
+ - name : Set up Flutter
21
+ uses : subosito/flutter-action@v2
22
+ with :
23
+ channel : ' stable'
43
24
44
- # Set keychain settings
45
- security set-keychain-settings -t 3600 -u ios-build.keychain
46
- security list-keychains -d user -s ios-build.keychain
25
+ - name : Flutter Pub Get
26
+ run : flutter pub get
47
27
48
- # Set partition list
49
- security set-key-partition-list -S apple-tool:,apple: -s -k "github-actions" ios-build.keychain
28
+ - name : Install CocoaPods Dependencies
29
+ run : |
30
+ cd ios
31
+ pod install
32
+ - name : Set up iOS Signing Keychain and Certificates
33
+ env :
34
+ IOS_CERTIFICATE_P12 : ${{ secrets.IOS_CERTIFICATE_P12 }}
35
+ IOS_CERTIFICATE_PASSWORD : ${{ secrets.IOS_CERTIFICATE_PASSWORD }}
36
+ IOS_PROVISIONING_PROFILE : ${{ secrets.IOS_PROVISIONING_PROFILE }}
37
+ run : |
38
+ # Create a custom keychain
39
+ security create-keychain -p "github-actions" ios-build.keychain
40
+ security default-keychain -s ios-build.keychain
41
+ security unlock-keychain -p "github-actions" ios-build.keychain
50
42
51
- # Install the provisioning profile
52
- mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
53
- echo $IOS_PROVISIONING_PROFILE | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/profile.mobileprovision
43
+ # Import the certificate (.p12)
44
+ echo $IOS_CERTIFICATE_P12 | base64 --decode > ios_certificate.p12
45
+ security import ios_certificate.p12 -k ios-build.keychain -P $IOS_CERTIFICATE_PASSWORD -T /usr/bin/codesign
54
46
55
- # 5. Ensure Flutter iOS is set up correctly
56
- - name : Flutter doctor (iOS)
57
- run : flutter doctor -v
47
+ # Set keychain settings
48
+ security set-keychain-settings -t 3600 -u ios-build.keychain
49
+ security list-keychains -d user -s ios-build.keychain
58
50
59
- # 6. Build iOS app
60
- - name : Build iOS app for release
61
- run : flutter build ios --release --no-codesign
51
+ # Set partition list
52
+ security set-key-partition-list -S apple-tool:,apple: -s -k "github-actions" ios-build.keychain
62
53
63
- # 7. Archive and Export IPA
64
- - name : Archive and Export IPA
65
- run : |
66
- # Archive the app
67
- xcodebuild -workspace ios/Runner.xcworkspace \
68
- -scheme Runner \
69
- -sdk iphoneos \
70
- -configuration Release \
71
- archive \
72
- -archivePath build/ios/Runner.xcarchive
54
+ # Install the provisioning profile
55
+ mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
56
+ echo $IOS_PROVISIONING_PROFILE | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/profile.mobileprovision
73
57
74
- # Export the .ipa file
75
- xcodebuild -exportArchive \
76
- -archivePath build/ios/Runner.xcarchive \
77
- -exportOptionsPlist ios/Runner/ExportOptions.plist \
78
- -exportPath build/ios
58
+ - name : Build iOS IPA
59
+ run : flutter build ipa --export-options-plist=ios/ExportOptions.plist
79
60
80
- # 8. Upload artifact (IPA) for later use
81
- - name : Upload IPA
82
- uses : actions/upload-artifact@v3
83
- with :
84
- name : iOS-Runner.ipa
85
- path : build/ios/*.ipa
61
+ - name : Upload IPA Artifact
62
+ uses : actions/upload-artifact@v4
63
+ with :
64
+ name : ios-app
65
+ path : build/ios/ipa/*.ipa
0 commit comments