Creating New Environments
This guide walks through creating a new development environment (like development3) for the Pivot Mobile app. This is useful when you need another isolated testing environment for a large feature.
Overview
Creating a new environment requires changes in several places:
Step 1: Apple Developer Portal
Create App ID (Bundle ID)
- Go to Apple Developer Portal
- Click Identifiers > + (Add)
- Select App IDs > Continue
- Select App > Continue
- Fill in:
- Description:
Pivot Dev 3(or your environment name) - Bundle ID:
jobs.pivot.dev3
- Description:
- Enable required Capabilities:
- Push Notifications
- Sign in with Apple
- Associated Domains (if using deep links)
- Click Register
Use the same Firebase project as development and development2 (pivot-dev-59310) to keep things simple.
Step 2: App Store Connect
Create App Entry
- Go to App Store Connect
- Click My Apps > + > New App
- Fill in:
- Platform: iOS
- Name:
Pivot Dev 3 - Primary Language: English (Canada)
- Bundle ID: Select
jobs.pivot.dev3 - SKU:
pivot-dev3
- Click Create
This creates the TestFlight destination for your builds.
Step 3: Xcode Configuration
Add Build Configurations
You need to add two new configurations: Dev3.debug and Dev3.release.
Using Xcode UI
- Open
ios/pivot3.xcworkspacein Xcode - Select the project (not a target) in the navigator
- Go to Info tab
- Under Configurations, click +
- Select Duplicate "Dev.debug" Configuration
- Name it
Dev3.debug - Repeat for
Dev3.release(duplicate fromDev.release)
Update Build Settings
For both pivot3 target and pivot3Tests target:
- Select the target
- Go to Build Settings
- Search for
Product Bundle Identifier - Set for
Dev3.debugandDev3.release:jobs.pivot.dev3 - Search for
Provisioning Profile - Set for
Dev3.release:match AdHoc jobs.pivot.dev3
Create Xcode Scheme
- In Xcode, go to Product > Scheme > Manage Schemes
- Select
dev.pivot3and click Duplicate - Rename to
dev3.pivot3 - Edit the scheme:
- Build Configuration:
Dev3.debugfor Run,Dev3.releasefor Archive
- Build Configuration:
- Mark as Shared (checkbox on the right)
This creates the scheme file at:
ios/pivot3.xcodeproj/xcshareddata/xcschemes/dev3.pivot3.xcscheme
Step 4: Provisioning Profile
Generate Profile with Fastlane Match
cd /path/to/pivot-mobile
bundle exec fastlane match adhoc \
--app_identifier jobs.pivot.dev3 \
--git_url git@github.com:pivotteam/pivot-mob-cert.git
This will:
- Create a new AdHoc provisioning profile
- Store it in the
pivot-mob-certrepository - Install it on your machine
If the profile already exists and needs capabilities updated, add --force:
bundle exec fastlane match adhoc --app_identifier jobs.pivot.dev3 --force
Step 5: Fastlane Lane
Add Lane to Fastfile
Edit fastlane/Fastfile and add a new lane:
lane :dev3 do
app_store_connect_api_key(
key_id: 'G29C8F9P69',
issuer_id: '69a6de95-eb63-47e3-e053-5b8c7c11a4d1',
key_filepath: './fastlane/qa_auth_key.p8'
)
latest_testflight = latest_testflight_build_number(
app_identifier: "jobs.pivot.dev3",
initial_build_number: 1
)
current_build = get_build_number(xcodeproj: "./ios/pivot3.xcodeproj")
new_build_number = [latest_testflight.to_i, current_build.to_i].max + 1
increment_build_number(
build_number: new_build_number,
xcodeproj: "./ios/pivot3.xcodeproj"
)
set_info_plist_value(
path: "./ios/pivot3/Info.plist",
key: "CurrentEnvironment",
value: "dev3"
)
match(
type: "adhoc",
app_identifier: "jobs.pivot.dev3",
git_url: "git@github.com:pivotteam/pivot-mob-cert.git",
readonly: true
)
copy_files(
source: "./ios/firebase/GoogleService-Info-development.plist",
destination: "./ios/pivot3/GoogleService-Info.plist"
)
build_app(
scheme: "dev3.pivot3",
configuration: "Dev3.release",
export_method: "ad-hoc",
workspace: "./ios/pivot3.xcworkspace",
output_directory: "./build",
output_name: "pivot3-dev3.ipa"
)
pilot(
app_identifier: "jobs.pivot.dev3",
skip_waiting_for_build_processing: true,
distribute_external: false
)
end
Step 6: GitHub Actions Workflow
Create Workflow File
Create .github/workflows/ios-dev3-build.yml:
name: iOS Dev3 Build
on:
push:
branches: [development3]
workflow_dispatch:
jobs:
build:
uses: ./.github/workflows/ios-build.yml
with:
environment: "Dev3"
fastlane_lane: "dev3"
secrets: inherit
Create the Branch
git checkout development
git checkout -b development3
git push -u origin development3
Step 7: Update Helper Script
Update switch-scheme.sh
Add the new scheme to switch-scheme.sh:
case $SCHEME in
dev)
SCHEME_NAME="dev.pivot3"
;;
dev2)
SCHEME_NAME="dev2.pivot3"
;;
dev3) # Add this
SCHEME_NAME="dev3.pivot3"
;;
qa)
SCHEME_NAME="qa.pivot3"
;;
prod)
SCHEME_NAME="pivot3"
;;
esac
Verification Checklist
After completing all steps, verify:
-
Apple Developer Portal
- App ID exists with correct capabilities
- Capabilities enabled: Push, Sign in with Apple
-
App Store Connect
- App entry created
- Can view app in TestFlight section
-
Xcode
-
Dev3.debugandDev3.releaseconfigurations exist -
dev3.pivot3scheme exists and is shared - Bundle ID set to
jobs.pivot.dev3
-
-
Fastlane
- Provisioning profile generated
- Lane added to Fastfile
-
GitHub
- Workflow file created
- Branch exists
Testing the Setup
Test Locally
# Switch to the new scheme
./switch-scheme.sh dev3
# Build in Xcode
# Product > Build
Test CI/CD
# Push to trigger workflow
git checkout development3
echo "test" >> README.md
git add README.md
git commit -m "Test dev3 build"
git push origin development3
Monitor the build at: https://github.com/pivotteam/Pivotmobile/actions
Summary of Files Changed
| File/Location | Change |
|---|---|
| Apple Developer Portal | New App ID |
| App Store Connect | New App |
ios/pivot3.xcodeproj/project.pbxproj | New configurations |
ios/pivot3.xcodeproj/xcshareddata/xcschemes/dev3.pivot3.xcscheme | New scheme |
fastlane/Fastfile | New lane |
.github/workflows/ios-dev3-build.yml | New workflow |
switch-scheme.sh | New case |
pivot-mob-cert repo | New provisioning profile |