Build BankSDK XCFrameworks #238
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build BankSDK XCFrameworks | |
on: | |
push: | |
tags: | |
- 'GiniBankSDK;[0-9]+.[0-9]+.[0-9]+;xcframeworks**' | |
- 'GiniBankSDK;[0-9]+.[0-9]+.[0-9]+-beta[0-9][0-9]+;xcframeworks**' | |
workflow_dispatch: | |
workflow_call: | |
secrets: | |
BUILD_CERTIFICATE_BASE64: | |
required: true | |
P12_PASSWORD: | |
required: true | |
BUILD_PROVISION_PROFILE_BASE64: | |
required: true | |
BUILD_PROVISION_PROFILE_EXTENSION_BASE64: | |
required: true | |
KEYCHAIN_PASSWORD: | |
required: true | |
jobs: | |
prepare-frameworks: | |
name: Create Release | |
runs-on: macos-13 | |
steps: | |
- uses: maxim-lobanov/[email protected] | |
with: | |
xcode-version: '14.3.1' | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Mint | |
uses: fabasoad/setup-mint-action@main | |
- name: Setup swift-create-xcframework | |
run: | | |
/usr/local/bin/brew install mint | |
/usr/local/bin/mint install unsignedapps/[email protected] | |
- name: GiniBankSDKPinning Project File | |
run: | | |
cd BankSDK/GiniBankSDKPinning | |
/usr/local/bin/mint run swift-create-xcframework | |
- name: setup ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.2.0' | |
bundler-cache: true | |
- name: Add resources to BankSDK target for generated Xcode project | |
uses: maierj/[email protected] | |
with: | |
lane: 'add_resources' | |
options: > | |
{ | |
"project_path": "../BankSDK/GiniBankSDKPinning/.build/swift-create-xcframework/GiniBankSDKPinning.xcodeproj", | |
"resource_name": "BankSDKResources", | |
"target_name": "GiniBankSDK", | |
"resources_path": "../BankSDK/GiniBankSDK/Sources/GiniBankSDK/Resources", | |
"ci": "true" | |
} | |
- name: Add resources to CaptureSDK target for generated Xcode project | |
uses: maierj/[email protected] | |
with: | |
lane: 'add_resources' | |
options: > | |
{ | |
"project_path": "../BankSDK/GiniBankSDKPinning/.build/swift-create-xcframework/GiniBankSDKPinning.xcodeproj", | |
"resource_name": "CaptureSDKResources", | |
"target_name": "GiniCaptureSDK", | |
"resources_path": "../CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Resources", | |
"ci": "true" | |
} | |
- name: Archiving project | |
run: | | |
xcodebuild archive -project BankSDK/GiniBankSDKPinning/.build/swift-create-xcframework/GiniBankSDKPinning.xcodeproj \ | |
-scheme GiniBankSDKPinning \ | |
-sdk iphonesimulator \ | |
-xcconfig Distribution.xcconfig \ | |
-configuration Release \ | |
-destination="iOS" \ | |
-archivePath "iphonesimulatorPinning.xcarchive" SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES | |
xcodebuild clean archive -project BankSDK/GiniBankSDKPinning/.build/swift-create-xcframework/GiniBankSDKPinning.xcodeproj \ | |
-scheme GiniBankSDKPinning -sdk iphoneos \ | |
-xcconfig Distribution.xcconfig \ | |
-configuration Release \ | |
-destination generic/platform=iOS \ | |
-archivePath "iphoneosPinning.xcarchive" SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES | |
- name: Generate XCFrameworks | |
run: | | |
xcodebuild -create-xcframework \ | |
-framework iphoneosPinning.xcarchive/Products/Library/Frameworks/GiniBankAPILibrary.framework \ | |
-framework iphonesimulatorPinning.xcarchive/Products/Library/Frameworks/GiniBankAPILibrary.framework \ | |
-output GiniBankAPILibrary.xcframework &&\ | |
\ | |
xcodebuild -create-xcframework \ | |
-framework iphoneosPinning.xcarchive/Products/Library/Frameworks/GiniCaptureSDK.framework \ | |
-framework iphonesimulatorPinning.xcarchive/Products/Library/Frameworks/GiniCaptureSDK.framework \ | |
-output GiniCaptureSDK.xcframework &&\ | |
\ | |
xcodebuild -create-xcframework \ | |
-framework iphoneosPinning.xcarchive/Products/Library/Frameworks/GiniBankSDK.framework \ | |
-framework iphonesimulatorPinning.xcarchive/Products/Library/Frameworks/GiniBankSDK.framework \ | |
-output GiniBankSDK.xcframework &&\ | |
\ | |
xcodebuild -create-xcframework \ | |
-framework iphoneosPinning.xcarchive/Products/Library/Frameworks/GiniBankAPILibraryPinning.framework \ | |
-framework iphonesimulatorPinning.xcarchive/Products/Library/Frameworks/GiniBankAPILibraryPinning.framework \ | |
-output GiniBankAPILibraryPinning.xcframework && \ | |
\ | |
xcodebuild -create-xcframework \ | |
-framework iphoneosPinning.xcarchive/Products/Library/Frameworks/GiniCaptureSDKPinning.framework \ | |
-framework iphonesimulatorPinning.xcarchive/Products/Library/Frameworks/GiniCaptureSDKPinning.framework \ | |
-output GiniCaptureSDKPinning.xcframework && \ | |
\ | |
xcodebuild -create-xcframework \ | |
-framework iphoneosPinning.xcarchive/Products/Library/Frameworks/GiniBankSDKPinning.framework \ | |
-framework iphonesimulatorPinning.xcarchive/Products/Library/Frameworks/GiniBankSDKPinning.framework \ | |
-output GiniBankSDKPinning.xcframework && \ | |
\ | |
xcodebuild -create-xcframework \ | |
-framework iphoneosPinning.xcarchive/Products/Library/Frameworks/TrustKit.framework \ | |
-framework iphonesimulatorPinning.xcarchive/Products/Library/Frameworks/TrustKit.framework \ | |
-output TrustKit.xcframework | |
- name: Sign the XCFrameworks | |
env: | |
BUILD_CERTIFICATE_BASE64: ${{ secrets.GINI_DISTRIBUTION_CERTIFICATE }} | |
P12_PASSWORD: ${{ secrets.GINI_DISTRIBUTION_CERTIFICATE_SECRET }} | |
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.GINI_BANK_SDK_EXAMPLE_ADHOC_DISTRIBUTION_PROVISION_PROFILE }} | |
BUILD_PROVISION_PROFILE_EXTENSION_BASE64: ${{ secrets.GINI_BANK_SDK_EXTENSION_ADHOC_DISTRIBUTION_PROVISION_PROFILE }} | |
KEYCHAIN_PASSWORD: ${{ secrets.GINI_DISTRIBUTION_CERTIFICATE_SECRET }} | |
run: | | |
# Setup distribution certificate | |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
PP_PATH1=$RUNNER_TEMP/build_pp1.mobileprovision | |
PP_PATH2=$RUNNER_TEMP/build_pp2.mobileprovision | |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
# import certificate and provisioning profile from secrets | |
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH | |
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH1 | |
echo -n "$BUILD_PROVISION_PROFILE_EXTENSION_BASE64" | base64 --decode -o $PP_PATH2 | |
# create temporary keychain | |
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | |
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
# import certificate to keychain | |
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
security list-keychain -d user -s $KEYCHAIN_PATH | |
# apply provisioning profile | |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
cp $PP_PATH1 ~/Library/MobileDevice/Provisioning\ Profiles | |
cp $PP_PATH2 ~/Library/MobileDevice/Provisioning\ Profiles | |
# sign xcframeworks | |
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniBankAPILibrary.xcframework && \ | |
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniCaptureSDK.xcframework && \ | |
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniBankSDK.xcframework && \ | |
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniBankAPILibraryPinning.xcframework && \ | |
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniCaptureSDKPinning.xcframework && \ | |
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniBankSDKPinning.xcframework | |
- name: archive frameworks GiniBankAPILibrary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: GiniBankSDKFramework | |
path: | | |
GiniBankAPILibrary.xcframework | |
GiniBankSDK.xcframework | |
GiniCaptureSDK.xcframework | |
TrustKit.xcframework | |
GiniBankSDKPinning.xcframework | |
GiniCaptureSDKPinning.xcframework | |
GiniBankAPILibraryPinning.xcframework | |