Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
pull_request:
branches:
- master
# Allow running the (pricier) macOS iOS build on demand from the Actions tab
# without opening a PR.
workflow_dispatch:

jobs:
build:
Expand Down Expand Up @@ -33,3 +36,57 @@ jobs:
- run: flutter analyze
- run: flutter test
- run: flutter build web

# Compiles the iOS app on a macOS runner. Proves the whole iOS toolchain is
# healthy — CocoaPods resolves the Firebase 12.x pods against the iOS 15
# deployment target, and Dart compiles/links to a native Runner.app — WITHOUT
# needing a paid Apple Developer account or signing certificates. This is the
# only way to build for iOS without a Mac of your own.
build-ios:
runs-on: macos-latest

steps:
- uses: actions/checkout@v6

- uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
channel: 'stable'

- name: Create secrets.dart from example (CI placeholder)
run: |
if [ ! -f lib/secrets.dart ]; then
cp lib/secrets.dart.example lib/secrets.dart
fi

- run: flutter pub get

# Runs `pod install` then compiles & links an unsigned release Runner.app.
# --no-codesign skips the parts that would require certificates/profiles.
- run: flutter build ios --release --no-codesign

# ----------------------------------------------------------------------
# NEXT STEP — ship to a physical device / TestFlight (needs a paid Apple
# Developer account, $99/yr). Replace the step above with a signed archive
# and upload. Sketch of the extra steps:
#
# - name: Import signing certificate
# uses: apple-actions/import-codesign-certs@v3
# with:
# p12-file-base64: ${{ secrets.IOS_DIST_CERT_P12 }}
# p12-password: ${{ secrets.IOS_DIST_CERT_PASSWORD }}
# - name: Install provisioning profile
# uses: apple-actions/download-provisioning-profiles@v3
# with:
# bundle-id: com.code418.postboxGame
# issuer-id: ${{ secrets.ASC_ISSUER_ID }}
# api-key-id: ${{ secrets.ASC_KEY_ID }}
# api-private-key: ${{ secrets.ASC_KEY_P8 }}
# - run: flutter build ipa --release --export-options-plist=ios/ExportOptions.plist
# - name: Upload to TestFlight
# run: |
# xcrun altool --upload-app -f build/ios/ipa/*.ipa -t ios \
# --apiKey "$ASC_KEY_ID" --apiIssuer "$ASC_ISSUER_ID"
#
# Add the secrets under: repo Settings -> Secrets and variables -> Actions.
# ----------------------------------------------------------------------
2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<string>15.0</string>
</dict>
</plist>
56 changes: 56 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Firebase iOS SDK 12.x (pinned by firebase_core) requires iOS 15.0 as the
# minimum deployment target. Keep this in sync with IPHONEOS_DEPLOYMENT_TARGET
# in Runner.xcodeproj and MinimumOSVersion in Flutter/AppFrameworkInfo.plist.
platform :ios, '15.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build
# latency; disabling it speeds up `pod install` in CI.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

# The app defines a `phone` flavor (mirroring the Android product flavours), so
# the Xcode project carries Debug/Profile/Release-phone build configurations in
# addition to the base ones. CocoaPods must know the build type of each, or it
# assumes :release and mislinks debug pods.
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
'Debug-phone' => :debug,
'Profile-phone' => :release,
'Release-phone' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
# Force every pod to the Firebase-required minimum. Some transitive pods
# still default to iOS 12/13, which breaks the archive against Firebase 12.x.
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
end
end
end
Loading
Loading