Skip to content

Commit 201c874

Browse files
author
ebreen
committed
fix(distribution): import both Apple Development and Developer ID Application certs
1 parent 198f2c6 commit 201c874

1 file changed

Lines changed: 28 additions & 16 deletions

File tree

.github/workflows/release.yml

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,37 +27,41 @@ jobs:
2727
- name: Install tools
2828
run: brew install create-dmg xcodegen
2929

30-
- name: Import code signing certificate
30+
- name: Import code signing certificates
3131
env:
32+
DEV_CERTIFICATE_BASE64: ${{ secrets.DEV_CERTIFICATE_BASE64 }}
33+
DEV_P12_PASSWORD: ${{ secrets.DEV_P12_PASSWORD }}
3234
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
3335
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
3436
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
3537
run: |
36-
CERTIFICATE_PATH="$RUNNER_TEMP/build_certificate.p12"
3738
KEYCHAIN_PATH="$RUNNER_TEMP/app-signing.keychain-db"
3839
39-
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o "$CERTIFICATE_PATH"
40-
4140
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
4241
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
4342
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
4443
45-
security import "$CERTIFICATE_PATH" -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
44+
# Import Apple Development cert (used by archive with automatic signing)
45+
echo -n "$DEV_CERTIFICATE_BASE64" | base64 --decode -o "$RUNNER_TEMP/dev_certificate.p12"
46+
security import "$RUNNER_TEMP/dev_certificate.p12" -P "$DEV_P12_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
47+
48+
# Import Developer ID Application cert (used by exportArchive for distribution)
49+
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o "$RUNNER_TEMP/build_certificate.p12"
50+
security import "$RUNNER_TEMP/build_certificate.p12" -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
51+
4652
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
4753
4854
# Make keychain visible to xcodebuild for both archive and export
4955
security default-keychain -s "$KEYCHAIN_PATH"
5056
security list-keychain -d user -s "$KEYCHAIN_PATH" /Library/Keychains/System.keychain
5157
52-
# Verify the correct certificate type is present
53-
echo "Checking for Developer ID Application certificate..."
58+
# Verify both certificates are present
59+
echo "Installed codesigning identities:"
60+
security find-identity -v -p codesigning "$KEYCHAIN_PATH"
5461
if ! security find-identity -v -p codesigning "$KEYCHAIN_PATH" | grep -q "Developer ID Application"; then
55-
echo "::error::BUILD_CERTIFICATE_BASE64 does not contain a Developer ID Application certificate."
56-
echo "Found identities:"
57-
security find-identity -v -p codesigning "$KEYCHAIN_PATH"
62+
echo "::error::BUILD_CERTIFICATE_BASE64 must contain a Developer ID Application certificate."
5863
exit 1
5964
fi
60-
security find-identity -v -p codesigning "$KEYCHAIN_PATH"
6165
6266
- name: Install provisioning profiles
6367
env:
@@ -80,20 +84,28 @@ jobs:
8084
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${{ github.run_number }}" CloudMount/Info.plist
8185
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${{ github.run_number }}" CloudMountExtension/Info.plist
8286
87+
- name: Decode API key for Xcode
88+
env:
89+
APP_STORE_CONNECT_KEY_BASE64: ${{ secrets.APP_STORE_CONNECT_KEY_BASE64 }}
90+
run: |
91+
echo -n "$APP_STORE_CONNECT_KEY_BASE64" | base64 --decode -o "$RUNNER_TEMP/AuthKey.p8"
92+
8393
- name: Archive
8494
env:
8595
TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
86-
SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
96+
API_KEY_ID: ${{ secrets.API_KEY_ID }}
97+
API_ISSUER_ID: ${{ secrets.API_ISSUER_ID }}
8798
run: |
8899
xcodebuild archive \
89100
-project CloudMount.xcodeproj \
90101
-scheme CloudMount \
91102
-archivePath "$RUNNER_TEMP/CloudMount.xcarchive" \
92103
-configuration Release \
93-
CODE_SIGN_STYLE=Manual \
94-
CODE_SIGN_IDENTITY="$SIGNING_IDENTITY" \
95-
DEVELOPMENT_TEAM="$TEAM_ID" \
96-
PROVISIONING_PROFILE_SPECIFIER=""
104+
-allowProvisioningUpdates \
105+
-authenticationKeyPath "$RUNNER_TEMP/AuthKey.p8" \
106+
-authenticationKeyID "$API_KEY_ID" \
107+
-authenticationKeyIssuerID "$API_ISSUER_ID" \
108+
DEVELOPMENT_TEAM="$TEAM_ID"
97109
98110
- name: Export archive
99111
env:

0 commit comments

Comments
 (0)