Skip to content

Commit 6c84428

Browse files
Working on iOS GitHub CI
1 parent 15e8ffd commit 6c84428

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

.github/workflows/pr_validation.yaml

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -79,29 +79,38 @@ jobs:
7979
working-directory: ./packages/flutter_test_runners/example_deep_links
8080

8181
steps:
82-
- name: Decode Provisioning Profile and Certificate
83-
working-directory: ~
82+
- name: Install the Apple certificate and provisioning profile
8483
env:
85-
PROVISIONING_PROFILE: ${{ secrets.PROVISIONING_PROFILE }}
86-
SIGNING_CERTIFICATE: ${{ secrets.SIGNING_CERTIFICATE }}
84+
BUILD_CERTIFICATE_BASE64: ${{ secrets.SIGNING_CERTIFICATE }}
85+
P12_PASSWORD: ${{ secrets.SIGNING_CERTIFICATE_PASSWORD }}
86+
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.PROVISIONING_PROFILE }}
87+
EXPORT_OPTIONS_PLIST: ${{ secrets.EXPORT_OPTIONS_PLIST }}
8788
run: |
88-
echo "$PROVISIONING_PROFILE" | base64 --decode > provisioning.mobileprovision
89-
echo "$SIGNING_CERTIFICATE" | base64 --decode > certificate.p12
90-
91-
- name: Install Certificate and Provisioning Profile
92-
working-directory: ~
93-
env:
94-
SIGNING_CERTIFICATE_PASSWORD: ${{ secrets.SIGNING_CERTIFICATE_PASSWORD }}
95-
run: |
96-
# Install the signing certificate
97-
security import certificate.p12 -k ~/Library/Keychains/login.keychain-db -P "$SIGNING_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
89+
# create variables
90+
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
91+
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
92+
KEYCHAIN_PATH=~/Library/Keychains/login.keychain-db
93+
94+
# import certificate and provisioning profile from secrets
95+
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
96+
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
9897
99-
# Move the provisioning profile to the correct location
98+
# create temporary keychain
99+
#security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
100+
#security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
101+
#security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
102+
103+
# import certificate to keychain
104+
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
105+
security list-keychain -d user -s $KEYCHAIN_PATH
106+
107+
# apply provisioning profile
100108
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
101-
mv provisioning.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/
102-
103-
# Verify the certificate
104-
security find-identity -p codesigning -v
109+
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
110+
111+
# Save ExportOptions.plist from Base64 to file
112+
EXPORT_OPTS_PATH=$RUNNER_TEMP/ExportOptions.plist
113+
echo -n "$EXPORT_OPTIONS_PLIST" | base64 --decode -o $EXPORT_OPTS_PATH
105114
106115
- name: Checkout repository
107116
uses: actions/checkout@v3
@@ -134,7 +143,7 @@ jobs:
134143
run: flutter pub get
135144

136145
- name: Build iOS App
137-
run: flutter build ios --debug
146+
run: flutter build ios --debug --export-options-plist=$EXPORT_OPTS_PATH
138147

139148
- name: Install iOS App
140149
run: flutter install ipa

0 commit comments

Comments
 (0)