Skip to content

build-sample

build-sample #733

env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
jobs:
build:
name: Build
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: dev
fetch-depth: 0
- name: Remove old directories
run: rm -rf ~/tmp | rm -rf ~/Library/MobileDevice
shell: bash
- name: Setup Sample Provisioning Profile
uses: davidSchuppa/base64Secret-toFile-action@v1
with:
destination-path: ~/Library/MobileDevice/Provisioning\ Profiles/
filename: EmarsysSampleProvProf.mobileprovision
secret: ${{ secrets.DEV_ACCOUNT_EMARSYS_SAMPLE_PROV_PROF_BASE64 }}
- name: Setup NotificationService Provisioning Profile
uses: davidSchuppa/base64Secret-toFile-action@v1
with:
destination-path: ~/Library/MobileDevice/Provisioning\ Profiles/
filename: EmarsysSampleNotificationServiceProvProf.mobileprovision
secret: ${{ secrets.DEV_ACCOUNT_EMARSYS_SAMPLE_NOTIFICATION_SERVICE_PROV_PROF_BASE64 }}
- name: Setup export options plist
uses: davidSchuppa/base64Secret-toFile-action@v1
with:
destination-path: ./Emarsys\ Sample
filename: exportOptions.plist
secret: ${{ secrets.TESTFLIGHT_EXPORT_OPTIONS_PLIST_BASE64 }}
- name: Setup Dev Account Dist Cert
uses: apple-actions/import-codesign-certs@v1
with:
keychain-password: ${{ secrets.KEYCHAIN_PASS }}
p12-file-base64: ${{ secrets.DEV_ACCOUNT_DIST_CERT_P12_BASE64 }}
p12-password: ${{ secrets.DEV_ACCOUNT_DIST_CERT_PASS }}
- name: Pod repo update
run: pod repo update
shell: bash
- name: Install Dependencies
run: cd Emarsys\ Sample && export DEV=true && pod deintegrate && rm -f Podfile.lock && pod update
shell: bash
- name: Clean project
run: cd Emarsys\ Sample && xcodebuild -workspace Emarsys-Sample.xcworkspace -scheme Emarsys-Sample -destination generic/platform=iOS -configuration Release clean
shell: bash
- name: Set build number for EmarsysSample
run: /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $(( ${{github.run_number}} + 1000 ))" ~/work/ios-emarsys-sdk/ios-emarsys-sdk/Emarsys\ Sample/Emarsys-Sample/Info.plist
shell: bash
- name: Set build number for NotificationService
run: /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $(($(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" ~/work/ios-emarsys-sdk/ios-emarsys-sdk/Emarsys\ Sample/Emarsys-Sample/Info.plist)))" ~/work/ios-emarsys-sdk/ios-emarsys-sdk/Emarsys\ Sample/NotificationService/Info.plist
shell: bash
- name: Archive project
run: cd Emarsys\ Sample && xcodebuild -workspace Emarsys-Sample.xcworkspace -scheme Emarsys-Sample -destination generic/platform=iOS -configuration Release archive -archivePath ./Emarsys-Sample.xcarchive clean
shell: bash
- name: Export ipa
run: cd Emarsys\ Sample && xcodebuild -exportArchive -archivePath ./Emarsys-Sample.xcarchive -exportOptionsPlist ./exportOptions.plist -exportPath ./ -allowProvisioningUpdates
shell: bash
- name: Upload app to TestFlight
uses: apple-actions/upload-testflight-build@v1
with:
app-path: '~/work/ios-emarsys-sdk/ios-emarsys-sdk/Emarsys Sample/Emarsys-Sample.ipa'
issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_API_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_API_PRIVATE_KEY }}
- if: ${{ failure() }}
name: Slack Notification On Error
uses: megamegax/[email protected]
with:
actions: '[{ "type": "button", "text": "View actions", "url": "https://github.com/emartech/ios-emarsys-sdk/actions" }]'
channel: ${{ secrets.SLACK_CHANNEL }}
job_status: failure
message: 'EmarsysSample build failed! :sob:'
user_icon: 'https://img.pngio.com/rotten-apple-png-images-vectors-and-psd-files-free-download-on-png-rotten-apple-260_391.png'
user_name: Emarsys SDK - iOS
- name: Slack Notification
uses: megamegax/[email protected]
with:
actions: '[{ "type": "button", "text": "View actions", "url": "https://github.com/emartech/ios-emarsys-sdk/actions" }]'
channel: ${{ secrets.SLACK_CHANNEL }}
job_status: success
message: 'Build successful! :man-gesturing-ok: :jobs:'
user_icon: 'https://www.apple.com/ac/structured-data/images/knowledge_graph_logo.png'
user_name: Emarsys SDK - iOS
name: Sample App Build
'on':
repository_dispatch:
types: [ build-sample ]
branches:
- dev
workflow_dispatch: