-
Notifications
You must be signed in to change notification settings - Fork 0
211 lines (180 loc) Β· 8.38 KB
/
ios-build.yml
File metadata and controls
211 lines (180 loc) Β· 8.38 KB
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
209
210
211
name: Build iOS App
on:
workflow_dispatch:
inputs:
build_number:
description: 'Build number (optional)'
required: false
type: string
default: ''
jobs:
build-ios:
name: Build iOS App
runs-on: macos-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache Flutter dependencies
uses: actions/cache@v4
with:
path: |
~/.flutter-cache
~/.pub-cache
key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-flutter-
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.41.1'
channel: 'stable'
- name: Extract app version
run: |
APP_VERSION=$(grep "final appVersion" lib/main.dart | sed 's/.*= "\(.*\)".*/\1/')
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
echo "π App version: $APP_VERSION"
- name: Setup iOS platform
run: |
# Check if Podfile exists
if [ ! -f "ios/Podfile" ]; then
echo "β οΈ Podfile not found. Regenerating iOS platform files..."
flutter precache --ios
flutter create --platforms ios .
echo "β
iOS platform files regenerated"
else
echo "β
Podfile found, proceeding with normal setup"
fi
- name: Set iOS platform version
run: |
# Set minimum iOS version for app compatibility
if grep -q "platform :ios" ios/Podfile; then
# Extract current iOS version from Podfile
CURRENT_VERSION=$(grep "platform :ios" ios/Podfile | sed -n "s/.*'\([0-9.]*\)'.*/\1/p")
echo "π± Current iOS platform version: $CURRENT_VERSION"
# Check if version is less than 13.0 (minimum for modern apps)
if [[ "$(printf '%s\n' "13.0" "$CURRENT_VERSION" | sort -V | head -n1)" != "13.0" ]]; then
echo "π§ Updating iOS platform to 13.0 (current: $CURRENT_VERSION)"
# Create temp file with new platform line at top
echo "platform :ios, '13.0'" > ios/Podfile.tmp
# Add all original content EXCEPT the old platform line
grep -v "platform :ios" ios/Podfile >> ios/Podfile.tmp
# Replace original with updated temp file
mv ios/Podfile.tmp ios/Podfile
echo "β
iOS platform updated to 13.0 for app compatibility"
else
echo "β
iOS platform version $CURRENT_VERSION is sufficient"
fi
else
echo "π§ Adding iOS 13.0 platform specification..."
sed -i '' '1i platform :ios, '\''13.0'\''' ios/Podfile
echo "β
iOS platform set to 13.0 for app compatibility"
fi
- name: Get iOS dependencies
run: |
cd ios
pod repo update
pod install
cd ..
- name: Clean build
run: flutter clean
- name: Get flutter dependencies
run: flutter pub get
- name: Build iOS release
run: |
flutter build ios \
--release \
--no-codesign \
--target lib/main.dart \
--dart-define=BUILD_NUMBER=${{ github.run_number }}
- name: Create IPA file
run: |
# Install Xcode command line tools if needed
if ! command -v xcrun &> /dev/null; then
xcode-select --install
fi
# Create a temporary directory for the IPA contents
mkdir -p build/ios-ipa
# Set the default build dir
BUILD_DIR="build/ios/iphoneos/Runner.app"
# if that doesn't work search for it
if [ -z "$BUILD_DIR" ]; then
BUILD_DIR=$(find build/ -name "Runner.app" -type d | head -1)
fi
if [ -z "$BUILD_DIR" ]; then
echo "β Could not find Runner.app in build/ios directory"
exit 1
fi
echo "π± Found app at: $BUILD_DIR"
# Copy the built app
cp -R "$BUILD_DIR" build/ios-ipa/
# Create Payload directory
mkdir -p build/ios-ipa/Payload
# Move app into Payload
mv build/ios-ipa/Runner.app build/ios-ipa/Payload/Selah.app
# Create IPA file
cd build/ios-ipa
zip -r "../../build/Selah-${{ env.APP_VERSION }}-${{ github.run_number }}.ipa" Payload
cd ../..
- name: Create Release and Upload IPA
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ios-v${{ env.APP_VERSION }}-build.${{ github.run_number }}
name: iOS Release - ${{ env.APP_VERSION }}-${{ github.run_number }}
draft: false
prerelease: false
files: build/Selah-${{ env.APP_VERSION }}-${{ github.run_number }}.ipa
body: |
## iOS Build ${{ github.run_number }}
### π¦ Package
- **Selah-${{ env.APP_VERSION }}-${{ github.run_number }}.ipa** - iOS app (unsigned for sideloading)
### π₯ Installation
1. Download the IPA file
2. Open Sideloadly on your computer
3. Connect your iPhone
4. Drag and drop the IPA into Sideloadly
5. Follow the installation prompts
6. Trust the developer profile on your iPhone (Settings > General > VPN & Device Management)
### βΉοΈ Build Info
- **Platform**: iOS
- **Minimum iOS**: 13.0
- **Build**: ${{ github.run_number }}
- **Timestamp**: ${{ github.event.head_commit.timestamp }}
- **Note**: App will need reinstallation every 7 days
Add any custom notes or updates here!
- name: Build Summary
run: |
echo "## β
iOS Build Complete" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Build Details:**" >> $GITHUB_STEP_SUMMARY
echo "- **Version:** Release Build (${{ env.APP_VERSION }})" >> $GITHUB_STEP_SUMMARY
echo "- **Build Number:** ${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY
echo "- **Platform:** iOS (iPhone/iPad)" >> $GITHUB_STEP_SUMMARY
echo "- **Configuration:** Release" >> $GITHUB_STEP_SUMMARY
echo "- **Backend:** Supabase" >> $GITHUB_STEP_SUMMARY
echo "- **iOS Target:** 13.0 (modern app compatibility)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**π₯ Download from GitHub Release:**" >> $GITHUB_STEP_SUMMARY
echo "The IPA has been uploaded to the [GitHub Release](https://github.com/toazd/selah/releases/tag/ios-v${{ env.APP_VERSION }}-build.${{ github.run_number }})." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**π¦ Available Package:**" >> $GITHUB_STEP_SUMMARY
echo "- **IPA:** Selah-${{ env.APP_VERSION }}-${{ github.run_number }}.ipa (iOS App Package, unsigned for sideloading)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**π± Installation Instructions:**" >> $GITHUB_STEP_SUMMARY
echo "1. Download the IPA file from the GitHub Release" >> $GITHUB_STEP_SUMMARY
echo "2. Open Sideloadly on your computer" >> $GITHUB_STEP_SUMMARY
echo "3. Connect your iPhone XR" >> $GITHUB_STEP_SUMMARY
echo "4. Drag and drop the downloaded IPA file into Sideloadly" >> $GITHUB_STEP_SUMMARY
echo "5. Follow Sideloadly's installation prompts" >> $GITHUB_STEP_SUMMARY
echo "6. Trust the developer profile on your iPhone (Settings > General > VPN & Device Management)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**β οΈ Important Notes:**" >> $GITHUB_STEP_SUMMARY
echo "- This is a debug build using free provisioning profiles" >> $GITHUB_STEP_SUMMARY
echo "- The app will need to be reinstalled every 7 days" >> $GITHUB_STEP_SUMMARY
echo "- Make sure your iPhone XR is connected and trusted" >> $GITHUB_STEP_SUMMARY
echo "- Supabase authentication and database will work with this build" >> $GITHUB_STEP_SUMMARY
echo "- If installation fails, try restarting your iPhone and Sideloadly" >> $GITHUB_STEP_SUMMARY
echo "- **Auto-fixes Applied:** iOS platform files regenerated, iOS target set to 15.0" >> $GITHUB_STEP_SUMMARY
echo "- **Version Logic:** Automatically updates iOS target to 15.0 if lower" >> $GITHUB_STEP_SUMMARY