Skip to content

Commit 23965e8

Browse files
authored
Merge pull request #92 from MAGICGrants/ios-build-workflow
Add ios build workflow
2 parents b22e20c + 7181084 commit 23965e8

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

.github/workflows/release.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,107 @@ jobs:
156156
name: windows-x64
157157
path: windows/Output/*.exe
158158

159+
build-ios:
160+
name: iOS
161+
runs-on: macos-latest
162+
environment: Release
163+
needs: version
164+
steps:
165+
- name: Checkout repository
166+
uses: actions/checkout@v4
167+
with:
168+
submodules: recursive
169+
170+
- name: Set up Flutter
171+
uses: subosito/flutter-action@v2
172+
with:
173+
channel: stable
174+
flutter-version: 3.41.0
175+
176+
- name: Install CocoaPods
177+
run: brew install cocoapods
178+
179+
- name: Set up Rust
180+
uses: dtolnay/rust-toolchain@stable
181+
with:
182+
targets: aarch64-apple-ios
183+
184+
- name: Import code signing
185+
env:
186+
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
187+
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
188+
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
189+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
190+
run: |
191+
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
192+
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
193+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
194+
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
195+
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
196+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
197+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
198+
security list-keychains -d user -s $KEYCHAIN_PATH
199+
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
200+
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
201+
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
202+
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision
203+
204+
- name: Configure Xcode for manual signing
205+
run: |
206+
PP_PATH="$HOME/Library/MobileDevice/Provisioning Profiles/build_pp.mobileprovision"
207+
security cms -D -i "$PP_PATH" -o "$RUNNER_TEMP/profile.plist"
208+
PROFILE_UUID=$(plutil -extract UUID raw "$RUNNER_TEMP/profile.plist")
209+
sed -i '' 's/CODE_SIGN_STYLE = Automatic;/CODE_SIGN_STYLE = Manual;/g' ios/Runner.xcodeproj/project.pbxproj
210+
sed -i '' "s/PROVISIONING_PROFILE_SPECIFIER = \"\";/PROVISIONING_PROFILE_SPECIFIER = \"$PROFILE_UUID\";/g" ios/Runner.xcodeproj/project.pbxproj
211+
sed -i '' 's/"CODE_SIGN_IDENTITY\[sdk=iphoneos\*\]" = "iPhone Developer";/"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Distribution";/g' ios/Runner.xcodeproj/project.pbxproj
212+
cat > ios/ExportOptions.plist << 'EOF'
213+
<?xml version="1.0" encoding="UTF-8"?>
214+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
215+
<plist version="1.0">
216+
<dict>
217+
<key>method</key>
218+
<string>app-store</string>
219+
<key>provisioningProfiles</key>
220+
<dict>
221+
<key>org.magicgrants.skylightwallet</key>
222+
<string>PROFILE_UUID_PLACEHOLDER</string>
223+
</dict>
224+
<key>signingCertificate</key>
225+
<string>Apple Distribution</string>
226+
<key>signingStyle</key>
227+
<string>manual</string>
228+
</dict>
229+
</plist>
230+
EOF
231+
sed -i '' "s/PROFILE_UUID_PLACEHOLDER/$PROFILE_UUID/g" ios/ExportOptions.plist
232+
233+
- name: Build IPA
234+
run: |
235+
flutter pub get
236+
flutter build ipa --dart-define=DEMO_MODE=true --release --export-options-plist=ios/ExportOptions.plist
237+
238+
- name: Prepare artifact
239+
run: |
240+
VERSION='${{ needs.version.outputs.version }}'
241+
mkdir -p dist
242+
cp -v build/ios/ipa/*.ipa "dist/skylight-wallet-${VERSION}.ipa"
243+
244+
- name: Upload to App Store Connect
245+
env:
246+
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
247+
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
248+
APP_STORE_CONNECT_PRIVATE_KEY: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY }}
249+
run: |
250+
mkdir -p ~/.appstoreconnect/private_keys
251+
echo "$APP_STORE_CONNECT_PRIVATE_KEY" > ~/.appstoreconnect/private_keys/AuthKey_${APP_STORE_CONNECT_KEY_ID}.p8
252+
chmod 600 ~/.appstoreconnect/private_keys/AuthKey_${APP_STORE_CONNECT_KEY_ID}.p8
253+
VERSION='${{ needs.version.outputs.version }}'
254+
xcrun altool --upload-app \
255+
--type ios \
256+
--file "dist/skylight-wallet-${VERSION}.ipa" \
257+
--apiKey "$APP_STORE_CONNECT_KEY_ID" \
258+
--apiIssuer "$APP_STORE_CONNECT_ISSUER_ID"
259+
159260
release:
160261
name: Sign + Release
161262
runs-on: ubuntu-latest

ios/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Flutter/flutter_export_environment.sh
2727
ServiceDefinitions.json
2828
Runner/GeneratedPluginRegistrant.*
2929
build/
30+
ExportOptions.plist
3031

3132
# Exceptions to above rules.
3233
!default.mode1v3

0 commit comments

Comments
 (0)