Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
format_version: 1.3.0
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
app:
envs:
- BITRISE_PROJECT_TITLE: lesson_5
opts:
is_expand: true
- BITRISE_DEV_BRANCH: master
opts:
is_expand: true
- PROJECT_TITLE: BitriseSampleWithYML
- XCODE_PROJECT_PATH: ./sample-apps-ios-with-bitrise-yml/${PROJECT_TITLE}.xcodeproj
- XCODE_PROJECT_SCHEME: ${PROJECT_TITLE}
- BITRISE_KEYCHAIN_PATH: $HOME/Library/Keychains/login.keychain
- BITRISE_KEYCHAIN_PASSWORD: keyChainPassword
workflows:
_download_certs:
description: This is a utility workflow, used by other workflows.
summary: This workflow downloads the needed certificates on the CI server and adds them to the keychain.
steps:
- git::https://github.com/bitrise-io/steps-certificate-and-profile-installer.git@master:
description: |-
This step will only be used in CI mode, on continuous integration
servers / services (because of the `run_if` statement),
but **NOT** when you run it on your own machine.
run_if: .IsCI
inputs:
- keychain_path: $BITRISE_KEYCHAIN_PATH
- keychain_password: $BITRISE_KEYCHAIN_PASSWORD
_setup:
description: Clone repo
steps:
- script:
title: clone
inputs:
- content: |-
#!/bin/bash
echo $XCODE_PROJECT_PATH
if [ ! -d $PROJECT_FOLDER ] ; then
git clone ${REPO_URL}
else
cd $PROJECT_FOLDER
git pull
fi
_cleanup:
description: |-
This is a utility workflow. It runs a script to delete the folders created in the setup.
steps:
- script:
title: Cleanup folder
description: |-
A script step to delete the downloaded Step folder.
run_if: not .IsCI
inputs:
- content: |-
#!/bin/bash
rm -rf $PROJECT_TITLE
analyze:
before_run:
- _setup
- _download_certs
description: |-
This workflow will run Xcode analyze on this project,
but first it'll run the workflows listed in
the `before_run` section.
steps:
- script:
title: Run Xcode analyze
inputs:
- content: xcodebuild -project "${XCODE_PROJECT_PATH}" -scheme "${XCODE_PROJECT_SCHEME}"
analyze
archive:
description: |-
This workflow will run Xcode archive on this project,
but first it'll run the workflows listed in
the `before_run` section.
before_run:
- _setup
- test
- _download_certs
steps:
- xcode-archive:
title: Run Xcode archive
inputs:
- project_path: ${XCODE_PROJECT_PATH}
- scheme: ${XCODE_PROJECT_SCHEME}
- output_dir: $output_dir
outputs:
- BITRISE_IPA_PATH: null
opts:
title: The created .ipa file's path
test:
steps:
- xcode-test:
title: Run Xcode test
inputs:
- project_path: ${XCODE_PROJECT_PATH}
- scheme: ${XCODE_PROJECT_SCHEME}
- simulator_device: iPhone 6
- simulator_os_version: latest
- is_clean_build: "no"
master:
description: |-
This workflow is meant to be used on a CI server (like bitrise.io), for continuous
deployment, but of course you can run it on your own Mac as well,
except the Step which deploys to Bitrise.io - that's marked with
a Run-If statement to be skipped, unless you run bitrise in --ci mode.
before_run:
- archive
after_run:
- _cleanup
steps:
- script:
inputs:
- content: |-
#!/bin/bash
echo "-> BITRISE_IPA_PATH: ${BITRISE_IPA_PATH}"
- bitrise-ios-deploy:
description: |-
The long `run_if` here is a workaround. At the moment Bitrise.io
defines the BITRISE_PULL_REQUEST environment
in case the build was started by a Pull Request, and not the
required PULL_REQUEST_ID - so we'll check for that instead.
run_if: enveq "BITRISE_PULL_REQUEST" "" | and .IsCI
inputs:
- notify_user_groups: none
- is_enable_public_page: "yes"
outputs:
- BITRISE_PUBLIC_INSTALL_PAGE_URL: null
opts:
title: Public Install Page URL
description: |-
Public Install Page's URL, if the
*Enable public page for the App?* option was *enabled*.
- slack:
run_if: .IsCI
inputs:
- webhook_url: ${SLACK_WEBHOOK_URL}
- channel: ${SLACK_CHANNEL}
- from_username: ${PROJECT_TITLE} - OK
- from_username_on_error: ${PROJECT_TITLE} - ERROR
- message: |-
CI check - OK
PULL_REQUEST_ID : ${PULL_REQUEST_ID}
BITRISE_PUBLIC_INSTALL_PAGE_URL: ${BITRISE_PUBLIC_INSTALL_PAGE_URL}
- message_on_error: |-
CI check - FAILED
PULL_REQUEST_ID : ${PULL_REQUEST_ID}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment