Build iOS app for simulator via xcodebuild and deploy it to Appetize.io for demos, customer support, testing etc.
Steps
Scipt step - To create the iOS .app for simulator:
- Script content if you have a workspace:
#!/usr/bin/env bash
set -e
set -x
xcodebuild "-workspace" "$BITRISE_SOURCE_DIR/$BITRISE_PROJECT_PATH" "-scheme" "$BITRISE_SCHEME" "-configuration" "$CONFIGURATION" "CODE_SIGN_IDENTITY=" "build" "-destination" "$SIMULATOR_IDENTITY" "PROVISIONING_PROFILE_SPECIFIER=" -derivedDataPath $BITRISE_SOURCE_DIR/ddata
- Script content if you have just a project:
#!/usr/bin/env bash
set -e
set -x
xcodebuild "-project" "$BITRISE_SOURCE_DIR/$BITRISE_PROJECT_PATH" "-scheme" "$BITRISE_SCHEME" "-configuration" "$CONFIGURATION" "CODE_SIGN_IDENTITY=" "build" "-destination" "$SIMULATOR_IDENTITY" "PROVISIONING_PROFILE_SPECIFIER=" -derivedDataPath $BITRISE_SOURCE_DIR/ddata
Create ZIP step - To export the builded .app to the deploy dir:
-
Source directory path:
$BITRISE_SOURCE_DIR/ddata/Build/Products/Debug-iphonesimulator/$BITRISE_SCHEME.app
-
Target directory path:
$BITRISE_DEPLOY_DIR/$BITRISE_SCHEME.zip
Deploy to Bitrise.io - Apps, Logs, Artifacts
- Just put this step there so you will have the .apps under the APPS & ARTIFACTS tab.
Appetize.io deploy
- Application path:
$BITRISE_DEPLOY_DIR/$BITRISE_SCHEME.zip
Create secrets:
-
APPETIZE_TOKEN
: The token provided by Appetize.io
NOTE: You can request an API token for Appetioze.io here: Appetize.io/request-api-token
Create envs:
-
SIMULATOR_IDENTITY:
platform=iOS Simulator,name=iPhone 6,OS=11.3
NOTE: This is only an example -
CONFIGURATION:
Debug
NOTE: This is only an example
Bitrise.yml:
It should look like this:
---
format_version: '5'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ios
trigger_map:
- push_branch: "*"
workflow: primary
- pull_request_source_branch: "*"
workflow: primary
workflows:
xcodebuild_simulator_script:
steps:
- activate-ssh-key:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone: {}
- cocoapods-install@1.7.2: {}
- script@1.1.5:
inputs:
- content: |-
#!/usr/bin/env bash
set -e
set -x
xcodebuild "-workspace" "$BITRISE_SOURCE_DIR/$BITRISE_PROJECT_PATH" "-scheme" "$BITRISE_SCHEME" "-configuration" "$CONFIGURATION" "CODE_SIGN_IDENTITY=" "build" "-destination" "$SIMULATOR_IDENTITY" "PROVISIONING_PROFILE_SPECIFIER=" -derivedDataPath $BITRISE_SOURCE_DIR/ddata
- create-zip@0.9.0:
inputs:
- destination: "$BITRISE_DEPLOY_DIR/$BITRISE_SCHEME.zip"
- source_path: "$BITRISE_SOURCE_DIR/ddata/Build/Products/Debug-iphonesimulator/$BITRISE_SCHEME.app"
- deploy-to-bitrise-io@1.3.12: {}
- appetize-deploy@0.9.0:
inputs:
- appetize_token: "$APPETIZE_TOKEN"
- app_path: "$BITRISE_DEPLOY_DIR/$BITRISE_SCHEME.zip"
app:
envs:
- opts:
is_expand: false
BITRISE_PROJECT_PATH: XcodeArchiveTest.xcworkspace
- opts:
is_expand: false
BITRISE_SCHEME: XcodeArchiveTest
- opts:
is_expand: false
BITRISE_EXPORT_METHOD: development
SIMULATOR_IDENTITY: platform=iOS Simulator,name=iPhone 6,OS=11.3
- opts:
is_expand: false
CONFIGURATION: Debug