-
Notifications
You must be signed in to change notification settings - Fork 11
186 lines (158 loc) · 7.93 KB
/
ios.yml
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
name: iOS Build
on:
push:
branches:
- Development
workflow_dispatch:
env:
CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
KEY_PWD: ${{ secrets.APPLE_KEY_PWD }}
DISTRIBUTION_CERTIFICATE: ${{ secrets.APPLE_APP_DISTRIBUTION_CERTIFICATE }}
DISTRIBUTION_PROFILE_PROD: ${{ secrets.APPLE_DISTRIBUTION_PROFILE }}
DISTRIBUTION_PROFILE_BUILD: ${{ secrets.APPLE_AD_HOC_PROFILE }}
TEAM_ID: ${{ secrets.TEAM_ID }}
jobs:
build:
runs-on: macOS-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@master
with:
node-version: '21.2.0'
- name: Install dependencies
run: npm install
- name: 'Create env file'
run: |
touch .env
echo apiUrlDevelop=${{ secrets.APIURLDEVELOP }} >> .env
echo facebookAppDisplayName=${{ secrets.FACEBOOKAPPDISPLAYNAME }} >> .env
echo facebookAppId=${{ secrets.FACEBOOKAPPID }} >> .env
echo facebookClientToken=${{ secrets.FACEBOOKCLIENTTOKEN }} >> .env
echo projectNumber=${{ secrets.PROJECTNUMBER }} >> .env
echo clientIdKey=${{ secrets.CLIENTIDKEY }} >> .env
- name: Putting data google service Dev file
env:
DATA: ${{ secrets.GOOGLE_SERVICES_PLIST_DEV }}
run: |
touch /Users/runner/work/parenting-app-bebbo-mobile/parenting-app-bebbo-mobile/ios/GoogleServices/Development/GoogleService-Info.plist
echo -n $DATA | base64 -d > /Users/runner/work/parenting-app-bebbo-mobile/parenting-app-bebbo-mobile/ios/GoogleServices/Development/GoogleService-Info.plist
- name: Copy fontello icon
env:
SOURCE_FILE_PATH: "/Users/runner/work/parenting-app-bebbo-mobile/parenting-app-bebbo-mobile/app/assets/fonts/fontello.ttf"
DESTINATION_DIR_PATH: "/Users/runner/work/parenting-app-bebbo-mobile/parenting-app-bebbo-mobile/node_modules/react-native-vector-icons/Fonts/fontello.ttf"
run: |
cp $SOURCE_FILE_PATH $DESTINATION_DIR_PATH
- name: Install CocoaPods
run: |
sudo gem install cocoapods
- name: Set environment variable for modular headers
run: echo "USE_MODULAR_HEADERS=true" >> $GITHUB_ENV
- name: Modify Podfile for Modular Headers
run: |
cd ios # Update this path if necessary
sed -i '' '1s/^/if ENV["USE_MODULAR_HEADERS"] == "true"\nuse_modular_headers!\nend\n\n/' Podfile
# cat Podfile
- name: Install pod dependencies
run: |
cd ios && rm -rf Pods Podfile.lock && pod install --repo-update
- name: Authenticate with Apple Developer account
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APP_SPECIFIC_PASSWORD: ${{ secrets.APP_SPECIFIC_PASSWORD }}
run: |
echo "machine apple.com login $APPLE_ID password $APP_SPECIFIC_PASSWORD" > ~/.netrc
security add-internet-password -a $APPLE_ID -s idmsa.apple.com -w $APP_SPECIFIC_PASSWORD -T /usr/bin/security
- name: Create and unlock keychain
run: |
security create-keychain -p $KEY_PWD build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p $KEY_PWD build.keychain
security set-keychain-settings -t 3600 -l ~/Library/Keychains/build.keychain
security list-keychains -d user
security show-keychain-info build.keychain || echo "Keychain info not available"
- name: Install Certificate
run: |
# Decode and install certificate
echo -n "$DISTRIBUTION_CERTIFICATE" | base64 -Dd -o certificate.p12
security import certificate.p12 -k ~/Library/Keychains/build.keychain -P "$CERTIFICATE_PASSWORD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k $CERTIFICATE_PASSWORD ~/Library/Keychains/build.keychain
- name: Install Provisioning Export
run: |
# Install provisioning profile
echo -n "$DISTRIBUTION_PROFILE_PROD" | base64 -Dd -o $RUNNER_TEMP/provisioning_profile.mobileprovision
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $RUNNER_TEMP/provisioning_profile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles
UUID=$(security cms -D -i $RUNNER_TEMP/provisioning_profile.mobileprovision | plutil -extract UUID raw -)
mv $RUNNER_TEMP/provisioning_profile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/$UUID.mobileprovision
- name: Install Provisioning build
run: |
# Install provisioning profile
echo -n "$DISTRIBUTION_PROFILE_BUILD" | base64 -Dd -o $RUNNER_TEMP/provisioning_profile_build.mobileprovision
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $RUNNER_TEMP/provisioning_profile_build.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles
UUID1=$(security cms -D -i $RUNNER_TEMP/provisioning_profile_build.mobileprovision | plutil -extract UUID raw -)
mv $RUNNER_TEMP/provisioning_profile_build.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/$UUID1.mobileprovision
- name: Prepare exportOptions.plist
run: |
cd ios &&
cat > exportOptions.plist <<EOL
<?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>compileBitcode</key>
<false/>
<key>destination</key>
<string>export</string>
<key>method</key>
<string>enterprise</string>
<key>signingStyle</key>
<string>automatic</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>$TEAM_ID</string>
<key>thinning</key>
<string><none></string>
</dict>
</plist>
EOL
# - name: Prepare exportOptions.plist
# run: |
# cd ios
# if [ -f exportOptions.plist ]; then
# echo "exportOptions.plist created successfully."
# cat exportOptions.plist # Optionally print the contents for verification
# else
# echo "Failed to create exportOptions.plist."
# exit 1
# fi
- name: Select Xcode
run: sudo xcode-select -switch /Applications/Xcode_15.1.app
- name: Xcode Version
run: /usr/bin/xcodebuild -version
- name: Create build folder
run: |
cd ./ios && mkdir -p build && mkdir -p staging
- name: Build Archive
run: |
cd ios && xcodebuild archive -workspace "ParentBuddyApp.xcworkspace" -scheme "ParentBuddyAppDev" -configuration "Release" -sdk iphoneos -UseModernBuildSystem=0 IPHONEOS_DEPLOYMENT_TARGET=12.0 -archivePath "./build/ParentBuddyApp.xcarchive" -allowProvisioningUpdates -quiet -hideShellScriptEnvironment
- name: Export Archive
run: |
cd ios && xcodebuild -verbose -exportArchive -allowProvisioningUpdates \
-archivePath "./build/ParentBuddyApp.xcarchive" \
-exportPath "ParentBuddyAppDev/" \
-exportOptionsPlist "exportOptions.plist"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Bebbo.ipa
path: "ios/ParentBuddyAppDev/"
- name: Clean up keychain and provisioning profile
if: ${{ always() }}
run: |
security delete-keychain ~/Library/Keychains/build.keychain
security delete-keychain ~/Library/Keychains/login.keychain-db
rm -f /Library/MobileDevice/Provisioning\ Profiles/*