Skip to content

Merge pull request #151 from DimensionSrl/feature/meet_ux_improvemements #285

Merge pull request #151 from DimensionSrl/feature/meet_ux_improvemements

Merge pull request #151 from DimensionSrl/feature/meet_ux_improvemements #285

Workflow file for this run

name: CI
on: [ pull_request, push ]
jobs:
## Test on latest MacOS
# test:
# runs-on: macos-14
# steps:
# - name: Checkout the code
# uses: actions/checkout@v2
# - name: Mock GoogleService-Info.plist
# run: mv NOICommunity/GoogleService-Info_mock.plist NOICommunity/GoogleService-Info.plist
# - name: Resolve package dependencies
# run: xcodebuild -resolvePackageDependencies
# - name: List schemes (optional step to gather information)
# run: xcodebuild -list -project NOICommunity.xcodeproj
# - name: Test the app
# run: |
# set -eo pipefail
# xcodebuild clean test \
# -scheme NOICommunity \
# -destination 'platform=iOS Simulator,OS=16.2,name=iPhone 14' \
# IPHONEOS_DEPLOYMENT_TARGET='16.2' \
# | xcpretty
## Deploy to TestFlight
deploy_testflight:
name: Deploy to Testflight
runs-on: macos-14
if: github.ref == 'refs/heads/main'
# needs: [ test ]
steps:
- name: Checkout the code
uses: actions/checkout@v2
# https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development
- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.IOS_BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.IOS_KEY_PASSPHRASE }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.IOS_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEY_PASSPHRASE }}
run: |
# create variables
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 -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $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
# Force Xcode specific version (if needed)
# This action switches Xcode to the specified version.
# For details on available versions of Xcode, see https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md.
# - name: Force XCode specific version
# run: sudo xcode-select -switch /Applications/Xcode_15.4.app
- name: Resolve package dependencies
run: xcodebuild -resolvePackageDependencies
- name: Inject GoogleService-Info.plist
env:
GOOGLE_SERVICE_INFO_PLIST: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST }}
run: echo "$GOOGLE_SERVICE_INFO_PLIST" > NOICommunity/GoogleService-Info.plist
- name: Increment build number
run: |
set -eo pipefail
BUILD_NUMBER=$(date "+%Y%m%d%H%M%S")
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $BUILD_NUMBER" NOICommunity/Info.plist
# Set the -configuration parameter to one of the following options:
# - "Release": uses the production Keycloak server
# - "Release TMA": uses the testingmachine-authentication Keycloak server
# - "Release DEVELOPER_MENU": same as "Release" but includes the Developer Menu
# - "Release TMA DEVELOPER_MENU": same as "Release TMA" but includes the Developer Menu
- name: Archive the project
run: |
set -eo pipefail
xcodebuild clean archive \
-configuration "Release" \
-scheme NOICommunity \
-sdk iphoneos \
-archivePath "$PWD/build/NOICommunity.xcarchive" \
-destination "generic/platform=iOS,name=Any iOS Device"
- name: Export .ipa
run: |
set -eo pipefail
xcodebuild -archivePath "$PWD/build/NOICommunity.xcarchive" \
-exportOptionsPlist exportOptions.plist \
-exportPath $PWD/build \
-allowProvisioningUpdates \
-exportArchive
- name: Publish the App on TestFlight
if: success()
env:
APPLEID_USERNAME: ${{ secrets.APPLEID_USERNAME }}
APPLEID_PASSWORD: ${{ secrets.APPLEID_PASSWORD }}
run: |
xcrun altool \
--upload-app \
-t ios \
-f $PWD/build/NOICommunity.ipa \
-u "$APPLEID_USERNAME" \
-p "$APPLEID_PASSWORD" \
--verbose
- name: Upload dSYMs to Firebase Crashlytics
if: success()
run: |
BUILD_DIR=$(xcodebuild -showBuildSettings | grep -m 1 "BUILD_DIR" | cut -d'=' -f2)
${BUILD_DIR%Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/upload-symbols \
-gsp "NOICommunity/GoogleService-Info.plist" \
-p ios \
"$PWD/build/NOICommunity.xcarchive/dSYMs"