Skip to content

Commit 39bad38

Browse files
committed
fix: use App Store Connect API key for iCloud provisioning in CI
1 parent 4760ad8 commit 39bad38

3 files changed

Lines changed: 26 additions & 28 deletions

File tree

.github/workflows/build.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,20 @@ jobs:
106106
--team-id "$APPLE_TEAM_ID" \
107107
--password "$NOTARY_PASSWORD"
108108
109+
- name: Install App Store Connect API key
110+
env:
111+
ASC_KEY_P8: ${{ secrets.ASC_KEY_P8 }}
112+
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
113+
run: |
114+
mkdir -p ~/private_keys
115+
echo "$ASC_KEY_P8" | base64 --decode > ~/private_keys/AuthKey_${ASC_KEY_ID}.p8
116+
109117
- name: Build ARM64
110118
env:
111119
ANALYTICS_HMAC_SECRET: ${{ secrets.ANALYTICS_HMAC_SECRET }}
112120
NOTARIZE: "true"
121+
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
122+
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
113123
run: |
114124
chmod +x scripts/build-release.sh
115125
scripts/build-release.sh arm64
@@ -217,10 +227,20 @@ jobs:
217227
--team-id "$APPLE_TEAM_ID" \
218228
--password "$NOTARY_PASSWORD"
219229
230+
- name: Install App Store Connect API key
231+
env:
232+
ASC_KEY_P8: ${{ secrets.ASC_KEY_P8 }}
233+
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
234+
run: |
235+
mkdir -p ~/private_keys
236+
echo "$ASC_KEY_P8" | base64 --decode > ~/private_keys/AuthKey_${ASC_KEY_ID}.p8
237+
220238
- name: Build x86_64
221239
env:
222240
ANALYTICS_HMAC_SECRET: ${{ secrets.ANALYTICS_HMAC_SECRET }}
223241
NOTARIZE: "true"
242+
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
243+
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
224244
run: |
225245
chmod +x scripts/build-release.sh
226246
scripts/build-release.sh x86_64

TablePro/TablePro.ci.entitlements

Lines changed: 0 additions & 10 deletions
This file was deleted.

scripts/build-release.sh

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -336,16 +336,6 @@ build_for_arch() {
336336
SPM_CACHE_DIR="${HOME}/.spm-cache"
337337
mkdir -p "$SPM_CACHE_DIR"
338338

339-
# Use CI entitlements (without iCloud) during build to avoid provisioning
340-
# profile requirement. The app is re-signed with real entitlements after build.
341-
local ci_entitlements="TablePro/TablePro.ci.entitlements"
342-
local real_entitlements="TablePro/TablePro.entitlements"
343-
if [ -f "$ci_entitlements" ]; then
344-
echo "📋 Using CI entitlements (iCloud stripped for build)..."
345-
cp "$real_entitlements" "$real_entitlements.bak"
346-
cp "$ci_entitlements" "$real_entitlements"
347-
fi
348-
349339
# Build with xcodebuild
350340
echo "Running xcodebuild..."
351341
if ! xcodebuild \
@@ -355,9 +345,12 @@ build_for_arch() {
355345
-arch "$arch" \
356346
ONLY_ACTIVE_ARCH=YES \
357347
CODE_SIGN_IDENTITY="$SIGN_IDENTITY" \
358-
CODE_SIGN_STYLE=Manual \
359348
DEVELOPMENT_TEAM="$TEAM_ID" \
360349
${ANALYTICS_HMAC_SECRET:+ANALYTICS_HMAC_SECRET="$ANALYTICS_HMAC_SECRET"} \
350+
-allowProvisioningUpdates \
351+
${ASC_KEY_ID:+-authenticationKeyID "$ASC_KEY_ID"} \
352+
${ASC_ISSUER_ID:+-authenticationKeyIssuerID "$ASC_ISSUER_ID"} \
353+
${ASC_KEY_ID:+-authenticationKeyPath "$HOME/private_keys/AuthKey_${ASC_KEY_ID}.p8"} \
361354
-skipPackagePluginValidation \
362355
-clonedSourcePackagesDirPath "$SPM_CACHE_DIR" \
363356
build 2>&1 | tee "build-${arch}.log"; then
@@ -367,11 +360,6 @@ build_for_arch() {
367360
fi
368361
echo "✅ Build succeeded for $arch"
369362

370-
# Restore real entitlements
371-
if [ -f "$real_entitlements.bak" ]; then
372-
mv "$real_entitlements.bak" "$real_entitlements"
373-
fi
374-
375363
# Get binary path with validation
376364
DERIVED_DATA=$(echo "$build_settings" | grep -m 1 "BUILD_DIR" | awk '{print $3}')
377365

@@ -517,8 +505,8 @@ build_for_arch() {
517505
done
518506
fi
519507

520-
# Sign the app bundle last (with real entitlements including iCloud)
521-
codesign -fs "$SIGN_IDENTITY" --force --options runtime --timestamp --entitlements "$real_entitlements" "$BUILD_DIR/$OUTPUT_NAME"
508+
# Sign the app bundle last
509+
codesign -fs "$SIGN_IDENTITY" --force --options runtime --timestamp --entitlements "TablePro/TablePro.entitlements" "$BUILD_DIR/$OUTPUT_NAME"
522510
echo "✅ Code signing complete"
523511

524512
# Verify signature

0 commit comments

Comments
 (0)