Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update from Cru #2

Merged
merged 26 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
19e1130
Starting to add some additional instructions for configuring AppConfi…
levieggertcru Jan 24, 2024
1a6487b
Add directory
levieggertcru Jan 24, 2024
84e8304
Configuring App Config
levieggertcru Jan 24, 2024
08f6c7f
Create build.yml
levieggertcru Feb 2, 2024
b9e6207
Merge pull request #10 from CruGlobal/update-readme-and-include-build…
levieggertcru Feb 2, 2024
6c2d6a9
Merge pull request #11 from CruGlobal/update-readme-and-include-build…
levieggertcru Feb 2, 2024
26d1cc3
Add Gemfile
levieggertcru Feb 2, 2024
4ccb8b4
Merge pull request #12 from CruGlobal/add-gemfile
levieggertcru Feb 2, 2024
5df6174
Disable automatic code signing
levieggertcru Feb 5, 2024
7fe5a7b
Merge pull request #13 from CruGlobal/update-readme-and-add-fastlane
levieggertcru Feb 5, 2024
68ef74e
Update readme
levieggertcru Feb 5, 2024
98e6548
Merge pull request #14 from CruGlobal/update-readme-and-add-fastlane
levieggertcru Feb 5, 2024
d0947bd
Remove conditional for app store connect api key
levieggertcru Feb 5, 2024
d64b9f0
Merge pull request #15 from CruGlobal/update-readme-and-add-fastlane
levieggertcru Feb 5, 2024
d49bce4
Update readme for fastlane specific files
levieggertcru Feb 6, 2024
9962f9f
Include Xcode project path
levieggertcru Feb 6, 2024
19ec713
Merge pull request #16 from CruGlobal/update-readme-and-add-fastlane
levieggertcru Feb 6, 2024
f05d031
Remove check for push to master
levieggertcru Feb 6, 2024
564bd71
Merge pull request #17 from CruGlobal/remove-check-in-build
levieggertcru Feb 6, 2024
9883aa3
Update readme and scheme to point to release
levieggertcru Feb 7, 2024
4b87cfc
Merge pull request #18 from CruGlobal/update-readme
levieggertcru Feb 7, 2024
3bb2035
Update settings for code signing release
levieggertcru Feb 7, 2024
506e7c9
Merge pull request #19 from CruGlobal/update-code-signing
levieggertcru Feb 7, 2024
95b17b1
Add app icon
levieggertcru Feb 7, 2024
ea17b74
Merge pull request #20 from CruGlobal/add-app-icon
levieggertcru Feb 7, 2024
af0b24c
Merge branch 'cru_main' into update
BarnumD May 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
)
Loading