Skip to content

Build HealthSDK XCFrameworks #20

Build HealthSDK XCFrameworks

Build HealthSDK XCFrameworks #20

name: Build HealthSDK XCFrameworks
on:
push:
tags:
- 'GiniHealthSDK;[0-9]+.[0-9]+.[0-9]+;xcframeworks**'
- 'GiniHealthSDK;[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
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: GiniHealthSDKPinning Project File
run: |
cd HealthSDK/GiniHealthSDKPinning
/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 HealthSDK target for generated Xcode project
uses: maierj/[email protected]
with:
lane: 'add_resources'
options: >
{
"project_path": "../HealthSDK/GiniHealthSDKPinning/.build/swift-create-xcframework/GiniHealthSDKPinning.xcodeproj",
"resource_name": "HealthSDKResources",
"target_name": "GiniHealthSDK",
"resources_path": "../HealthSDK/GiniHealthSDK/Sources/GiniHealthSDK/Resources",
"ci": "true"
}
- name: Archiving project
run: |
xcodebuild archive -project HealthSDK/GiniHealthSDKPinning/.build/swift-create-xcframework/GiniHealthSDKPinning.xcodeproj \
-scheme GiniHealthSDKPinning \
-sdk iphonesimulator \
-xcconfig Distribution.xcconfig \
-configuration Release \
-destination="iOS" \
-archivePath "iphonesimulatorPinning.xcarchive" SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
xcodebuild clean archive -project HealthSDK/GiniHealthSDKPinning/.build/swift-create-xcframework/GiniHealthSDKPinning.xcodeproj \
-scheme GiniHealthSDKPinning -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/GiniHealthAPILibrary.framework \
-framework iphonesimulatorPinning.xcarchive/Products/Library/Frameworks/GiniHealthAPILibrary.framework \
-output GiniHealthAPILibrary.xcframework &&\
\
xcodebuild -create-xcframework \
-framework iphoneosPinning.xcarchive/Products/Library/Frameworks/GiniHealthSDK.framework \
-framework iphonesimulatorPinning.xcarchive/Products/Library/Frameworks/GiniHealthSDK.framework \
-output GiniHealthSDK.xcframework &&\
\
xcodebuild -create-xcframework \
-framework iphoneosPinning.xcarchive/Products/Library/Frameworks/GiniHealthAPILibraryPinning.framework \
-framework iphonesimulatorPinning.xcarchive/Products/Library/Frameworks/GiniHealthAPILibraryPinning.framework \
-output GiniHealthAPILibraryPinning.xcframework && \
\
xcodebuild -create-xcframework \
-framework iphoneosPinning.xcarchive/Products/Library/Frameworks/GiniHealthSDKPinning.framework \
-framework iphonesimulatorPinning.xcarchive/Products/Library/Frameworks/GiniHealthSDKPinning.framework \
-output GiniHealthSDKPinning.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_HEALTH_SDK_EXAMPLE_APP_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
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
# 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
# sign xcframeworks
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniHealthAPILibrary.xcframework && \
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniHealthSDK.xcframework && \
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniHealthAPILibraryPinning.xcframework && \
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniHealthSDKPinning.xcframework
- name: archive frameworks GiniHealthAPILibrary
uses: actions/upload-artifact@v4
with:
name: GiniHealthSDKFramework
path: |
GiniHealthAPILibrary.xcframework
GiniHealthSDK.xcframework
GiniHealthSDKPinning.xcframework
GiniHealthAPILibraryPinning.xcframework
TrustKit.xcframework