Skip to content

Commit

Permalink
Merge pull request #2 from Wycliffe-USA/update
Browse files Browse the repository at this point in the history
Update from Cru
  • Loading branch information
BarnumD authored May 31, 2024
2 parents 8bdb17a + af0b24c commit c031027
Show file tree
Hide file tree
Showing 8 changed files with 235 additions and 4 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build App

on:
push:
branches: [ develop, master ]
pull_request:
branches: [ develop, master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: macos-14
env:
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 60

steps:

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

- name: Select Xcode Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.2.0'

- name: MPDXiOSLib SSH Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.MPDX_IOS_LIB_SSH_PRIVATE_KEY }}

- name: Bundle Install
run: bundle install

- name: Import App Store Connect API Key
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
APP_STORE_CONNECT_API_JSON_PAYLOAD: ${{ secrets.APP_STORE_CONNECT_API_JSON_PAYLOAD }}
run: echo $APP_STORE_CONNECT_API_JSON_PAYLOAD > fastlane/AppleAppStoreApi.json

- name: Increment Xcode Project Build Number
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: bundle exec fastlane cru_shared_lane_increment_xcode_project_build_number

- name: Build And Deploy For TestFlight Release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
MATCH_GIT_BASIC_AUTHORIZATION_PAT: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION_PAT }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
run: bundle exec fastlane cru_shared_lane_build_and_deploy_for_testflight_release is_running_in_ci:true
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4575B09D2A6817D400A11377"
BuildableName = "MPDXClientExampleSwiftPackageManager.app"
BlueprintName = "MPDXClientExampleSwiftPackageManager"
ReferencedContainer = "container:MPDXClientExampleSwiftPackageManager.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4575B09D2A6817D400A11377"
BuildableName = "MPDXClientExampleSwiftPackageManager.app"
BlueprintName = "MPDXClientExampleSwiftPackageManager"
ReferencedContainer = "container:MPDXClientExampleSwiftPackageManager.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4575B09D2A6817D400A11377"
BuildableName = "MPDXClientExampleSwiftPackageManager.app"
BlueprintName = "MPDXClientExampleSwiftPackageManager"
ReferencedContainer = "container:MPDXClientExampleSwiftPackageManager.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Release">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ MPDX Client App
Instrucitons for building this app, taken from Cru's mpdx-ios-client-example-app
Includes Swift Package Manager and Cocoapods example projects to facilitate in the creation of your templated MPDX iOS App.

- [Steps To Create Templated MPDX iOS App](#steps-to-create-templated-mpdx-ios-app)
- [Configuring AppConfig](#configuring-appconfig)
- [Distribution](#distribution)

### Requirements

Expand Down Expand Up @@ -113,3 +116,95 @@ NOTE: You can view the latest MPDXiOSLib version either [here](https://github.co
### App Localization

Localizable.strings files are bundled in MPDXiOSLib and by default your templated MPDX App will support the following languages found [here](https://github.com/CruGlobal/mpdx-ios-lib/blob/develop/fastlane/.env.default#L3).


### Configuring AppConfig

The AppConfigInterface.swift exists to configure anything specific to your app. When creating the AppDelegate.swift you will override MPDXAppDelegate getAppConfig() to return your own instance with configuration settings. AppConfigInterface.swift contains the following configuration attributes.

###### - apiBaseUrl: String
This is the base url that points to your API. For example MPDX Staging uses https://api.stage.mpdx.org
###### - authenticationConfiguration: AuthenticationConfiguration

###### - coreDatabaseConfiguration: CoreDatabaseConfiguration
###### - deepLinkingConfiguration: DeepLinkingConfiguration?
This is optional and you can return a DeepLinkingConfiguration value to enable deeplinking into your app.

###### - firebaseConfiguration: FirebaseConfiguration?
This is optional and you can return a FirebaseConfiguration value to enable firebase analytics. Here you will provide the name of the GoogleService file .plist created in Firebase and added to your Xcode project. For example in MPDX we use GoogleService-Info for the firebaseGoogleServiceFileName.

###### - googleAnalyticsConfiguration: GoogleAnalyticsConfiguration?
This is optional and you can return a GoogleAnalyticsConfiguration value to enable google analytics. Here you will provide your google analtyics identifier. The dispatch interval is optional and can be lowered for debugging purposes.
###### - impersonateConfiguration: MPDXApiImpersonateConfiguration?
For this setting return nil. We've been experimenting with a way to impersonate users for debugging purposes only and this isn't something that is available.

### Distribution

For automated build distributions we use a GitHub Actions workflow with a combination of Fastlane and GitHub Actions secrets.

###### Add Gemfile

The client example contains a Gemfile in the project directory. Add this same Gemfile to your project directory. The GitHub Actions workflow will utilize this Gemfile for installing any dependencies such as Fastlane.

###### Add Fastlane

This next step will involve adding Fastlane to your project.

In your project directory create a folder named fastlane and add the following files.
- Fastfile
- Matchfile
- .gitignore
- .env.default

###### Fastfile

For the Fastfile copy the same contents as in the client example (https://github.com/CruGlobal/mpdx-ios-client-example-app/blob/main/fastlane/Fastfile).

###### Matchfile

For the Matchfile copy the contents from the client example (https://github.com/CruGlobal/mpdx-ios-client-example-app/blob/main/fastlane/Matchfile).

IMPORTANT: The git URL will need to be your own private repository git url for code signing. See the section below for Fastlane Match.


###### .gitignore

For the .gitignore copy the same contents as in the client example (https://github.com/CruGlobal/mpdx-ios-client-example-app/blob/main/fastlane/.gitignore).

Fastlane creates an AppleAppStoreApi.json file which is used for the App Store Connect API so this file needs to be ignored.

###### .env.default

For the .env.default copy the same contents as in the client example (https://github.com/CruGlobal/mpdx-ios-client-example-app/blob/main/fastlane/.env.default). You will need to update some values that are specific to your app.

APP_RELEASE_BUNDLE_IDENTIFIER - this value will be your app store app bundle id.
APP_STORE_CONNECT_API_KEY_JSON_FILE_PATH = this value must match the mpdx client example.

## Code Signing
CODE_SIGNING_APP_BUNDLE_IDS - this value will be your app store app bundle id.
CODE_SIGNING_PROVISIONING_PROFILE_NAMES - this value would replace org.cru.mpdxclientexample with your app store app bundle id.
CODE_SIGNING_TARGETS - this value is the main target for your app.
CODE_SIGNING_TEAM_ID - this value will match your team id in the apple developer membership.

## Match
MATCH_GIT_BRANCH = "master"
MATCH_GIT_URL - this value will match the git url for the created code signing repo.
MATCH_KEYCHAIN_NAME = "orgcrumpdxclientexample"

## Gym
GYM_RELEASE_APP_BUNDLE_IDENTIFIER - this value
GYM_RELEASE_PROVISIONING_PROFILE = "match AppStore org.cru.mpdxclientexample"
GYM_RELEASE_SCHEME = "MPDXClientExampleSwiftPackageManager"

###### Fastlane Match

This step will involve creating a private repository for storing your distribution certificate and provisioning profile for code signing. Fastlane utilizes Match for sharing one code signing identity across your development team.

For more information on the benefits of storing your code signing credentials in a private repository see (https://codesigning.guide/).

For instructions on setting up Fastlane Match see (https://docs.fastlane.tools/actions/match/).

Once Fastlane Match is setup, you will need to add the created private repository git url to a couple files in your fastlane folder.

- In your Matchfile, add the giturl with your created private repository git url.
- In your .env.default set the MATCH_GIT_URL value to your private repository git url.
1 change: 1 addition & 0 deletions Wycliffe MyPD.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@
DEVELOPMENT_ASSET_PATHS = "\"Wycliffe MyPD/Preview Content\"";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 8RN78QKV8J;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Wycliffe-MyPD-Info.plist";
Expand Down
3 changes: 3 additions & 0 deletions fastlane/.env.default
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ MATCH_KEYCHAIN_NAME = "orgwycliffemypd"
GYM_RELEASE_APP_BUNDLE_IDENTIFIER = "org.wycliffe.mypd"
GYM_RELEASE_PROVISIONING_PROFILE = "match AppStore org.wycliffe.mypd"
GYM_RELEASE_SCHEME = "Wycliffe MyPD"

## Xcode Project
XCODE_PROJECT_PATH = "./ExampleProjects/SwiftPackageManager/MPDXClientExampleSwiftPackageManager.xcodeproj"
2 changes: 1 addition & 1 deletion fastlane/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
AppleAppStoreAPI.json
AppleAppStoreApi.json
6 changes: 3 additions & 3 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import_from_git(
url: "https://github.com/CruGlobal/cru-fastlane-files",
branch: "master",
path: "Fastfile"
url: "https://github.com/CruGlobal/cru-fastlane-files",
branch: "master",
path: "Fastfile"
)

0 comments on commit c031027

Please sign in to comment.