Skip to content

Commit

Permalink
Merge remote-tracking branch 'main' into PM-129-expose-function-to-cl…
Browse files Browse the repository at this point in the history
…ose-the-bank-sdk
  • Loading branch information
igor-gini committed Feb 5, 2025
2 parents 426893d + 755767f commit d0e8593
Show file tree
Hide file tree
Showing 108 changed files with 3,753 additions and 454 deletions.
62 changes: 62 additions & 0 deletions .github/publish_to_firebase.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash

set -o pipefail

# Required since https://github.blog/2022-04-12-git-security-vulnerability-announced
git config --global --add safe.directory $GITHUB_WORKSPACE

RELEASE_NOTES=""
RELEASE_NOTES_FILE=""

TOKEN_DEPRECATED_WARNING_MESSAGE="⚠ This action will stop working with the next future major version of firebase-tools! Migrate to Service Account. See more: https://github.com/wzieba/Firebase-Distribution-Github-Action/wiki/FIREBASE_TOKEN-migration"

if [[ -z ${INPUT_RELEASENOTES} ]]; then
RELEASE_NOTES="$(git log -1 --pretty=short)"
else
RELEASE_NOTES=${INPUT_RELEASENOTES}
fi

if [[ ${INPUT_RELEASENOTESFILE} ]]; then
RELEASE_NOTES=""
RELEASE_NOTES_FILE=${INPUT_RELEASENOTESFILE}
fi

if [ -n "${INPUT_SERVICECREDENTIALSFILE}" ] ; then
export GOOGLE_APPLICATION_CREDENTIALS="${INPUT_SERVICECREDENTIALSFILE}"
fi

if [ -n "${INPUT_SERVICECREDENTIALSFILECONTENT}" ] ; then
cat <<< "${INPUT_SERVICECREDENTIALSFILECONTENT}" > service_credentials_content.json
export GOOGLE_APPLICATION_CREDENTIALS="service_credentials_content.json"
fi

if [ -n "${INPUT_TOKEN}" ] ; then
echo ${TOKEN_DEPRECATED_WARNING_MESSAGE}
export FIREBASE_TOKEN="${INPUT_TOKEN}"
fi

firebase \
appdistribution:distribute \
"$INPUT_FILE" \
--app "$INPUT_APPID" \
--groups "$INPUT_GROUPS" \
--testers "$INPUT_TESTERS" \
${RELEASE_NOTES:+ --release-notes "${RELEASE_NOTES}"} \
${INPUT_RELEASENOTESFILE:+ --release-notes-file "${RELEASE_NOTES_FILE}"} \
$( (( $INPUT_DEBUG )) && printf %s '--debug' ) |
{
while read -r line; do
echo $line

if [[ $line == *"View this release in the Firebase console"* ]]; then
CONSOLE_URI=$(echo "$line" | sed -e 's/.*: //' -e 's/^ *//;s/ *$//')
echo "FIREBASE_CONSOLE_URI=$CONSOLE_URI" >>"$GITHUB_OUTPUT"
elif [[ $line == *"Share this release with testers who have access"* ]]; then
TESTING_URI=$(echo "$line" | sed -e 's/.*: //' -e 's/^ *//;s/ *$//')
echo "TESTING_URI=$TESTING_URI" >>"$GITHUB_OUTPUT"
elif [[ $line == *"Download the release binary"* ]]; then
BINARY_URI=$(echo "$line" | sed -e 's/.*: //' -e 's/^ *//;s/ *$//')
echo "BINARY_DOWNLOAD_URI=$BINARY_URI" >>"$GITHUB_OUTPUT"
fi
done
}
50 changes: 42 additions & 8 deletions .github/workflows/bank-sdk.publish.example.app.firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,47 @@ jobs:
files: "*.ipa"
fail: true

- name: Install Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20

- run: npm install -g [email protected]
shell: bash

- name: Distribute bank-sdk example ipa to Firebase App Distribution
uses: emertozd/Firebase-Distribution-Github-Action@v2
id: distribute
run: |
chmod +x .github/publish_to_firebase.sh
.github/publish_to_firebase.sh
shell: bash
env:
INPUT_APPID: ${{ secrets.GINI_BANK_SDK_EXAMPLE_APP_FIREBASE_ID }}
INPUT_SERVICECREDENTIALSFILECONTENT: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
INPUT_FILE: GiniBankSDKExample.ipa
INPUT_GROUPS: testers
INPUT_RELEASENOTES: |
${{ format('{{ {0} {1} }}', github.ref, github.sha) }}
${{ github.event.head_commit.message }}
- name: Extract Jira ticket
id: extract_jira_ticket
run: |
commit_message=$(git log -1 --pretty=%B)
jira_ticket=$(echo "$commit_message" | awk 'NR > 1 && $0 != "" { print $0; exit }')
echo "JIRA_TICKET_NAME=${jira_ticket}" >> $GITHUB_ENV
- name: Login to jira
if: ${{ env.JIRA_TICKET_NAME != null }}
uses: justin-jhg/gajira-login@v1
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_KEY }}

- name: Comment on issue
if: ${{ env.JIRA_TICKET_NAME != null }}
uses: atlassian/gajira-comment@v3
with:
appId: ${{ secrets.GINI_BANK_SDK_EXAMPLE_APP_FIREBASE_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
groups: testers
file: GiniBankSDKExample.ipa
releaseNotes: |
${{ format('{{ {0} {1} }}', github.ref, github.sha) }}
${{ github.event.head_commit.message }}
issue: ${{ env.JIRA_TICKET_NAME }}
comment: Build bank example app ${{ steps.distribute.outputs.FIREBASE_CONSOLE_URI }}
79 changes: 79 additions & 0 deletions .github/workflows/health-sdk.build.xcframeworks.xcode16.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build HealthSDK XCFrameworks XCode 16
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-15
steps:
- uses: maxim-lobanov/[email protected]
with:
xcode-version: '16.2'

- name: Checkout repository
uses: actions/checkout@v4

- name: Archiving project and creating XCFrameworks
run: |
./build-healthsdk.sh
- 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)" GiniInternalPaymentSDK.xcframework && \
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniUtilites.xcframework
- name: archive frameworks GiniHealthAPILibrary
uses: actions/upload-artifact@v4
with:
name: GiniHealthSDKFramework
path: |
GiniHealthAPILibrary.xcframework
GiniHealthSDK.xcframework
GiniInternalPaymentSDK.xcframework
GiniUtilites.xcframework
83 changes: 8 additions & 75 deletions .github/workflows/health-sdk.build.xcframeworks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,85 +18,18 @@ on:
jobs:
prepare-frameworks:
name: Create Release
runs-on: macos-13
runs-on: macos-14
steps:
- uses: maxim-lobanov/[email protected]
with:
xcode-version: '14.3.1'
xcode-version: '15.4'

- 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
- name: Archiving project and creating 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
./build-healthsdk.sh
- name: Sign the XCFrameworks
env:
Expand Down Expand Up @@ -131,8 +64,8 @@ jobs:
# 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
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniInternalPaymentSDK.xcframework && \
codesign --timestamp -v --sign "Apple Distribution: Gini GmbH (JA825X8F7Z)" GiniUtilites.xcframework
- name: archive frameworks GiniHealthAPILibrary
uses: actions/upload-artifact@v4
Expand All @@ -141,6 +74,6 @@ jobs:
path: |
GiniHealthAPILibrary.xcframework
GiniHealthSDK.xcframework
GiniHealthSDKPinning.xcframework
GiniHealthAPILibraryPinning.xcframework
GiniInternalPaymentSDK.xcframework
GiniUtilites.xcframework
60 changes: 48 additions & 12 deletions .github/workflows/health-sdk.publish.example.apps.firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ jobs:
- name: Setup Credentials
run: |
plutil -replace client_id -string "gini-mobile-test" HealthSDK/GiniHealthSDKExample/GiniHealthSDKExample/CredentialsManager.swift
plutil -replace client_password -string "${{ secrets.GINI_MOBILE_TEST_CLIENT_SECRET }}" HealthSDK/GiniHealthSDKExample/GiniHealthSDKExample/CredentialsManager.swift
sed -i '' \
-e 's/clientID = "client_id"/clientID = "gini-mobile-test"/' \
-e 's/clientPassword = "client_password"/clientPassword = "${{ secrets.GINI_MOBILE_TEST_CLIENT_SECRET }}"/' \
HealthSDK/GiniHealthSDKExample/GiniHealthSDKExample/CredentialsManager.swift
- name: Archiving project
run: |
xcodebuild clean archive \
Expand Down Expand Up @@ -107,14 +109,48 @@ jobs:
with:
files: "*.ipa"
fail: true


- name: Install Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20

- run: npm install -g [email protected]
shell: bash

- name: Distribute health-sdk example ipa to Firebase App Distribution
uses: emertozd/Firebase-Distribution-Github-Action@v2
id: distribute
run: |
chmod +x .github/publish_to_firebase.sh
.github/publish_to_firebase.sh
shell: bash
env:
INPUT_APPID: ${{ secrets.GINI_HEALTH_SDK_EXAMPLE_APP_FIREBASE_ID }}
INPUT_SERVICECREDENTIALSFILECONTENT: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
INPUT_FILE: GiniHealthSDKExample.ipa
INPUT_GROUPS: testers
INPUT_RELEASENOTES: |
${{ format('{{ {0} {1} }}', github.ref, github.sha) }}
${{ github.event.head_commit.message }}
- name: Extract Jira ticket
id: extract_jira_ticket
run: |
commit_message=$(git log -1 --pretty=%B)
jira_ticket=$(echo "$commit_message" | awk 'NR > 1 && $0 != "" { print $0; exit }')
echo "JIRA_TICKET_NAME=${jira_ticket}" >> $GITHUB_ENV
- name: Login to jira
if: ${{ env.JIRA_TICKET_NAME != null }}
uses: justin-jhg/gajira-login@v1
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_KEY }}

- name: Comment on issue
if: ${{ env.JIRA_TICKET_NAME != null }}
uses: atlassian/gajira-comment@v3
with:
appId: ${{ secrets.GINI_HEALTH_SDK_EXAMPLE_APP_FIREBASE_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
groups: testers
file: GiniHealthSDKExample.ipa
releaseNotes: |
${{ format('{{ {0} {1} }}', github.ref, github.sha) }}
${{ github.event.head_commit.message }}
issue: ${{ env.JIRA_TICKET_NAME }}
comment: Build health example app ${{ steps.distribute.outputs.FIREBASE_CONSOLE_URI }}
Loading

0 comments on commit d0e8593

Please sign in to comment.