Skip to content

Merge pull request #988 from UNICEFECAR/fixImportIssue-208952 #15

Merge pull request #988 from UNICEFECAR/fixImportIssue-208952

Merge pull request #988 from UNICEFECAR/fixImportIssue-208952 #15

Workflow file for this run

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_PROD }}
DISTRIBUTION_PROFILE_PROD: ${{ secrets.APPLE_DISTRIBUTION_PROFILE_PROD }}
DISTRIBUTION_PROFILE_BUILD: ${{ secrets.APPLE_AD_HOC_PROFILE_PROD }}
TEAM_ID: ${{ secrets.TEAM_ID_PROD }}
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_PROD }} >> .env
echo encryptionsKey=${{ secrets.ENCRYPTIONS_KEY }} >> .env
echo encryptionsIVKey=${{ secrets.ENCRYPTIONS_IV_KEY }} >> .env
- name: Putting data google service prod file
env:
DATA: ${{ secrets.GOOGLE_SERVICES_PLIST_PROD }}
run: |
touch /Users/runner/work/parenting-app-bebbo-mobile/parenting-app-bebbo-mobile/ios/GoogleServices/Production/GoogleService-Info.plist
echo -n $DATA | base64 -d > /Users/runner/work/parenting-app-bebbo-mobile/parenting-app-bebbo-mobile/ios/GoogleServices/Production/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: Install App Store Connect CLI
run: sudo gem install fastlane
- 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_PROD }}
APP_SPECIFIC_PASSWORD: ${{ secrets.APP_SPECIFIC_PASSWORD_PROD }}
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>app-store</string>
<key>signingStyle</key>
<string>automatic</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>$TEAM_ID</string>
<key>provisioningProfiles</key>
<dict>
<key>org.unicef.ecar.bebbo</key>
<string>Bebbo_Production_Unicef</string>
</dict>
<key>thinning</key>
<string>&lt;none&gt;</string>
</dict>
</plist>
EOL
- 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 "ParentBuddyApp" -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 "ParentBuddyApp/" \
-exportOptionsPlist "exportOptions.plist"
- name: Upload to TestFlight
env:
APPLE_ID: ${{ secrets.APPLE_ID_PROD }}
APP_SPECIFIC_PASSWORD: ${{ secrets.APP_SPECIFIC_PASSWORD_PROD }}
run: |
xcrun altool --upload-app \
-t ios \
-f ParentBuddyApp/ParentBuddyApp.ipa \
-u $APPLE_ID \
-p $APP_SPECIFIC_PASSWORD \
--output-format xml
# - name: Upload Artifacts
# uses: actions/upload-artifact@v4
# with:
# name: Bebbo.ipa
# path: "ios/ParentBuddyApp/"
- 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/*