Skip to content

Commit

Permalink
ci: Change deploy action
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkray committed Sep 24, 2024
1 parent 3d9e370 commit 1049dac
Show file tree
Hide file tree
Showing 3 changed files with 245 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/bank-sdk.publish.example.app.firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,7 @@ jobs:
file: GiniBankSDKExample.ipa
app: ${{ secrets.GINI_BANK_SDK_EXAMPLE_APP_FIREBASE_ID }}
credentials: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
testers: testers
release-notes: |
${{ format('{{ {0} {1} }}', github.ref, github.sha) }}
${{ github.event.head_commit.message }}
118 changes: 118 additions & 0 deletions .github/workflows/health-sdk.publish.example.apps.firebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Publish GiniHealthSDKExample to App Center
on:
push:
paths:
- 'HealthSDK/**'
- 'HealthAPILibrary/**'
workflow_dispatch:
jobs:
check:
uses: gini/gini-mobile-ios/.github/workflows/health-sdk.check.yml@main
secrets:
GINI_MOBILE_TEST_CLIENT_SECRET: ${{ secrets.GINI_MOBILE_TEST_CLIENT_SECRET }}

upload-version:
needs: check
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: maxim-lobanov/[email protected]
with:
xcode-version: '15.3'

- name: Setup provisioning profile
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: |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH
# 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_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Setup Manual Signing for Xcode project
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.0'
bundler-cache: true
- uses: maierj/[email protected]
with:
lane: 'setup_manual_signing'
options: >
{
"project_path":"HealthSDK/GiniHealthSDKExample/GiniHealthSDKExample.xcodeproj",
"team_id":"JA825X8F7Z",
"target":"GiniHealthSDKExample",
"bundle_identifier": "net.gini.healthsdk.example",
"profile_name": "Gini Health SDK Example App Ad-Hoc Distribution",
"entitlements_file_path": "GiniHealthSDKExample/GiniHealthSDKExample.entitlements",
"ci": "true"
}
- name: Setup Credentials
run: |
plutil -replace client_id -string "gini-mobile-test" HealthSDK/GiniHealthSDKExample/GiniHealthSDKExample/Credentials.plist
plutil -replace client_password -string "${{ secrets.GINI_MOBILE_TEST_CLIENT_SECRET }}" HealthSDK/GiniHealthSDKExample/GiniHealthSDKExample/Credentials.plist
- name: Archiving project
run: |
xcodebuild clean archive \
-workspace GiniMobile.xcworkspace \
-scheme "GiniHealthSDKExample" \
-archivePath ./GiniHealthSDKExample.xcarchive \
-configuration Release \
-destination generic/platform=iOS \
CODE_SIGN_IDENTITY="Apple Distribution" \
CODE_SIGNING_REQUIRED=NO \
ONLY_ACTIVE_ARCH=NO \
CODE_SIGN_STYLE=Manual \
DEVELOPMENT_TEAM=JA825X8F7Z
- name: Exporting .ipa
run: |
xcodebuild \
-exportArchive \
-archivePath GiniHealthSDKExample.xcarchive \
-exportPath . \
-exportOptionsPlist ExportOptionsHealthExample.plist \
-destination "generic/platform=iOS" \
CODE_SIGNING_REQUIRED=YES \
ONLY_ACTIVE_ARCH=NO \
CODE_SIGN_STYLE=Manual
- name: Check file existence
uses: andstor/file-existence-action@v3
with:
files: "*.ipa"

- name: Distribute health-sdk example ipa to Firebase App Distribution
uses: nickwph/firebase-app-distribution-action@v1
with:
file: GiniHealthSDKExample.ipa
app: ${{ secrets.GINI_HEALTH_SDK_EXAMPLE_APP_FIREBASE_ID }}
credentials: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
testers: testers
release-notes: |
${{ format('{{ {0} {1} }}', github.ref, github.sha) }}
${{ github.event.head_commit.message }}
123 changes: 123 additions & 0 deletions .github/workflows/merchant-sdk.publish.example.apps.firebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Publish GiniMerchantSDKExample to App Center
on:
push:
paths:
- 'MerchantSDK/**'
- 'HealthAPILibrary/**'
workflow_dispatch:
jobs:
check:
uses: ./.github/workflows/merchant-sdk.check.yml
secrets:
GINI_MOBILE_TEST_CLIENT_SECRET: ${{ secrets.GINI_MOBILE_TEST_CLIENT_SECRET }}

upload-version:
needs: check
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: maxim-lobanov/[email protected]
with:
xcode-version: '15.3'

- name: Setup provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.GINI_DISTRIBUTION_CERTIFICATE }}
P12_PASSWORD: ${{ secrets.GINI_DISTRIBUTION_CERTIFICATE_SECRET }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.GINI_MERCHANT_SDK_EXAMPLE_APP_ADHOC_DISTRIBUTION_PROVISION_PROFILE }}
KEYCHAIN_PASSWORD: ${{ secrets.GINI_DISTRIBUTION_CERTIFICATE_SECRET }}
run: |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH
# 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_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Setup Manual Signing for Xcode project
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.0'
bundler-cache: true
- uses: maierj/[email protected]
with:
lane: 'setup_manual_signing'
options: >
{
"project_path":"MerchantSDK/GiniMerchantSDKExample/GiniMerchantSDKExample.xcodeproj",
"team_id":"JA825X8F7Z",
"target":"GiniMerchantSDKExample",
"bundle_identifier": "net.gini.merchantsdk.example",
"profile_name": "Gini Merchant SDK Example App Ad-Hoc Distribution",
"entitlements_file_path": "GiniMerchantSDKExample/GiniMerchantSDKExample.entitlements",
"ci": "true"
}
- name: Setup Credentials
run: |
sed -i '' \
-e 's/clientID = "client_id"/clientID = "gini-mobile-test"/' \
-e 's/clientPassword = "client_password"/clientPassword = "${{ secrets.GINI_MOBILE_TEST_CLIENT_SECRET }}"/' \
MerchantSDK/GiniMerchantSDKExample/GiniMerchantSDKExample/Sources/CredentialsManager.swift
- name: Archiving project
run: |
xcodebuild clean archive \
-workspace GiniMobile.xcworkspace \
-scheme "GiniMerchantSDKExample" \
-archivePath ./GiniMerchantSDKExample.xcarchive \
-configuration Release \
-destination generic/platform=iOS \
CODE_SIGN_IDENTITY="Apple Distribution" \
CODE_SIGNING_REQUIRED=NO \
ONLY_ACTIVE_ARCH=NO \
CODE_SIGN_STYLE=Manual \
DEVELOPMENT_TEAM=JA825X8F7Z
- name: Exporting .ipa
run: |
xcodebuild \
-exportArchive \
-archivePath GiniMerchantSDKExample.xcarchive \
-exportPath . \
-exportOptionsPlist ExportOptionsMerchantExample.plist \
-destination "generic/platform=iOS" \
CODE_SIGNING_REQUIRED=YES \
ONLY_ACTIVE_ARCH=NO \
CODE_SIGN_STYLE=Manual
- name: Check file existence
uses: andstor/file-existence-action@v3
with:
files: "*.ipa"

- name: Distribute merchant-sdk example ipa to Firebase App Distribution
uses: nickwph/firebase-app-distribution-action@v1
with:
file: GiniMerchantSDKExample.ipa
app: ${{ secrets.GINI_MERCHANT_SDK_EXAMPLE_APP_FIREBASE_ID }}
credentials: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
testers: testers
release-notes: |
${{ format('{{ {0} {1} }}', github.ref, github.sha) }}
${{ github.event.head_commit.message }}

0 comments on commit 1049dac

Please sign in to comment.