Skip to content

Commit f60b8d0

Browse files
author
Nik Sauer
committed
test
1 parent 9d43f78 commit f60b8d0

File tree

1 file changed

+44
-64
lines changed

1 file changed

+44
-64
lines changed

.github/workflows/build-ios.yml

Lines changed: 44 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Flutter iOS Build
1+
name: Build iOS App
22

33
on:
44
push:
@@ -7,79 +7,59 @@ on:
77
pull_request:
88
branches:
99
- main
10+
workflow_dispatch:
1011

1112
jobs:
12-
build_ios:
13+
build:
14+
name: Build iOS App
1315
runs-on: macos-latest
14-
1516
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
3919

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'
4324

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
4727

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
5042
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
5446
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
5850
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
6253
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
7357
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
7960

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

Comments
 (0)