-
Notifications
You must be signed in to change notification settings - Fork 1
232 lines (202 loc) · 7.8 KB
/
Copy pathios.yml
File metadata and controls
232 lines (202 loc) · 7.8 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: iOS
on:
push:
paths:
- ".github/workflows/ios.yml"
- "iosApp/**"
- "shared/**"
- "gradle/**"
- "build.gradle.kts"
- "settings.gradle.kts"
- "gradle.properties"
pull_request:
paths:
- ".github/workflows/ios.yml"
- "iosApp/**"
- "shared/**"
- "gradle/**"
- "build.gradle.kts"
- "settings.gradle.kts"
- "gradle.properties"
workflow_dispatch:
inputs:
build_signed_ipa:
description: "Build a development-signed IPA for registered iPhones"
required: true
type: boolean
default: false
permissions:
contents: read
concurrency:
group: ios-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
simulator-app:
name: Build iOS Simulator app
runs-on: macos-26
timeout-minutes: 60
steps:
- name: Check out source
uses: actions/checkout@v6
- name: Set up JDK 23
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "23"
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
- name: Select Xcode 26.4
run: sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer
- name: Show Apple toolchain
run: xcodebuild -version
- name: Build unsigned Simulator app
run: |
xcodebuild \
-project iosApp/iosApp.xcodeproj \
-scheme iosApp \
-configuration Debug \
-sdk iphonesimulator \
-destination "generic/platform=iOS Simulator" \
-derivedDataPath build/ios-simulator \
CODE_SIGNING_ALLOWED=NO \
TEAM_ID= \
build
- name: Package Simulator app
run: |
APP_PATH="build/ios-simulator/Build/Products/Debug-iphonesimulator/Sync360.app"
test -d "$APP_PATH"
ditto -c -k --sequesterRsrc --keepParent "$APP_PATH" Sync360-iOS-Simulator.zip
- name: Upload Simulator app
uses: actions/upload-artifact@v4
with:
name: Sync360-iOS-Simulator
path: Sync360-iOS-Simulator.zip
if-no-files-found: error
retention-days: 14
signed-iphone-ipa:
name: Build signed iPhone IPA
if: github.event_name == 'workflow_dispatch' && inputs.build_signed_ipa
runs-on: macos-26
timeout-minutes: 60
env:
IOS_DEVELOPMENT_CERTIFICATE_BASE64: ${{ secrets.IOS_DEVELOPMENT_CERTIFICATE_BASE64 }}
IOS_DEVELOPMENT_CERTIFICATE_PASSWORD: ${{ secrets.IOS_DEVELOPMENT_CERTIFICATE_PASSWORD }}
IOS_DEVELOPMENT_PROVISIONING_PROFILE_BASE64: ${{ secrets.IOS_DEVELOPMENT_PROVISIONING_PROFILE_BASE64 }}
IOS_TEAM_ID: ${{ secrets.IOS_TEAM_ID }}
steps:
- name: Check out source
uses: actions/checkout@v6
- name: Set up JDK 23
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "23"
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
- name: Select Xcode 26.4
run: sudo xcode-select --switch /Applications/Xcode_26.4.app/Contents/Developer
- name: Require Apple signing secrets
shell: bash
run: |
missing=0
for secret_name in \
IOS_DEVELOPMENT_CERTIFICATE_BASE64 \
IOS_DEVELOPMENT_CERTIFICATE_PASSWORD \
IOS_DEVELOPMENT_PROVISIONING_PROFILE_BASE64 \
IOS_TEAM_ID
do
if [ -z "${!secret_name:-}" ]; then
echo "::error::Missing GitHub Actions secret: $secret_name"
missing=1
fi
done
exit "$missing"
- name: Install development certificate and provisioning profile
shell: bash
run: |
CERTIFICATE_PATH="$RUNNER_TEMP/ios-development.p12"
PROFILE_PATH="$RUNNER_TEMP/ios-development.mobileprovision"
PROFILE_PLIST="$RUNNER_TEMP/ios-development-profile.plist"
KEYCHAIN_PATH="$RUNNER_TEMP/sync360-signing.keychain-db"
KEYCHAIN_PASSWORD="$(openssl rand -hex 24)"
printf '%s' "$IOS_DEVELOPMENT_CERTIFICATE_BASE64" | base64 --decode > "$CERTIFICATE_PATH"
printf '%s' "$IOS_DEVELOPMENT_PROVISIONING_PROFILE_BASE64" | base64 --decode > "$PROFILE_PATH"
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security import "$CERTIFICATE_PATH" \
-P "$IOS_DEVELOPMENT_CERTIFICATE_PASSWORD" \
-A \
-t cert \
-f pkcs12 \
-k "$KEYCHAIN_PATH"
security set-key-partition-list \
-S apple-tool:,apple: \
-s \
-k "$KEYCHAIN_PASSWORD" \
"$KEYCHAIN_PATH"
security list-keychains -d user -s "$KEYCHAIN_PATH"
security cms -D -i "$PROFILE_PATH" > "$PROFILE_PLIST"
PROFILE_UUID="$(/usr/libexec/PlistBuddy -c 'Print :UUID' "$PROFILE_PLIST")"
PROFILE_NAME="$(/usr/libexec/PlistBuddy -c 'Print :Name' "$PROFILE_PLIST")"
APPLICATION_IDENTIFIER="$(/usr/libexec/PlistBuddy -c 'Print :Entitlements:application-identifier' "$PROFILE_PLIST")"
BUNDLE_IDENTIFIER="${APPLICATION_IDENTIFIER#*.}"
mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles"
cp "$PROFILE_PATH" "$HOME/Library/MobileDevice/Provisioning Profiles/$PROFILE_UUID.mobileprovision"
echo "IOS_PROFILE_NAME=$PROFILE_NAME" >> "$GITHUB_ENV"
echo "IOS_BUNDLE_IDENTIFIER=$BUNDLE_IDENTIFIER" >> "$GITHUB_ENV"
echo "IOS_ARCHIVE_PATH=$RUNNER_TEMP/Sync360.xcarchive" >> "$GITHUB_ENV"
echo "IOS_EXPORT_PATH=$RUNNER_TEMP/ios-export" >> "$GITHUB_ENV"
security find-identity -v -p codesigning "$KEYCHAIN_PATH"
- name: Archive signed iPhone app
shell: bash
run: |
xcodebuild \
-project iosApp/iosApp.xcodeproj \
-scheme iosApp \
-configuration Debug \
-destination "generic/platform=iOS" \
-archivePath "$IOS_ARCHIVE_PATH" \
TEAM_ID="$IOS_TEAM_ID" \
PRODUCT_BUNDLE_IDENTIFIER="$IOS_BUNDLE_IDENTIFIER" \
DEVELOPMENT_TEAM="$IOS_TEAM_ID" \
CODE_SIGN_STYLE=Manual \
CODE_SIGN_IDENTITY="Apple Development" \
PROVISIONING_PROFILE_SPECIFIER="$IOS_PROFILE_NAME" \
archive
- name: Export signed IPA
shell: bash
run: |
EXPORT_OPTIONS="$RUNNER_TEMP/ExportOptions.plist"
cat > "$EXPORT_OPTIONS" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>debugging</string>
<key>signingStyle</key>
<string>manual</string>
<key>teamID</key>
<string>$IOS_TEAM_ID</string>
<key>provisioningProfiles</key>
<dict>
<key>$IOS_BUNDLE_IDENTIFIER</key>
<string>$IOS_PROFILE_NAME</string>
</dict>
</dict>
</plist>
EOF
xcodebuild \
-exportArchive \
-archivePath "$IOS_ARCHIVE_PATH" \
-exportOptionsPlist "$EXPORT_OPTIONS" \
-exportPath "$IOS_EXPORT_PATH"
test -n "$(find "$IOS_EXPORT_PATH" -maxdepth 1 -name '*.ipa' -print -quit)"
- name: Upload signed IPA
uses: actions/upload-artifact@v4
with:
name: Sync360-iPhone-Development-IPA
path: ${{ runner.temp }}/ios-export/*.ipa
if-no-files-found: error
retention-days: 14