Created
April 10, 2020 16:33
-
-
Save cgradwohl/c7023d632539763a247e3703250950b6 to your computer and use it in GitHub Desktop.
Friday bitrise.yml backup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
format_version: '8' | |
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git | |
project_type: react-native | |
trigger_map: | |
- push_branch: master | |
workflow: production | |
- push_branch: staging | |
workflow: staging | |
- push_branch: "*" | |
workflow: development | |
- pull_request_target_branch: staging | |
workflow: pull_request | |
- pull_request_target_branch: master | |
workflow: pull_request | |
workflows: | |
development: | |
after_run: | |
- primary | |
steps: | |
- [email protected]: | |
title: Development Workflow | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
envman add --key ENVIRONMENT --value "Development" | |
envman add --key IOS_DISTRIBUTION_TYPE --value "ad-hoc" | |
envman add --key ANDROID_VARIANT --value "debug" | |
staging: | |
after_run: | |
- primary | |
steps: | |
- [email protected]: | |
title: Staging Workflow | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
envman add --key ENVIRONMENT --value "Staging" | |
envman add --key IOS_CODE_PUSH_KEY --value $IOS_CODE_PUSH_KEY_STAGING | |
envman add --key ANDROID_CODE_PUSH_KEY --value $ANDROID_CODE_PUSH_KEY_STAGING | |
envman add --key IOS_DISTRIBUTION_TYPE --value "ad-hoc" | |
envman add --key ANDROID_VARIANT --value "release" | |
production: | |
after_run: | |
- primary | |
steps: | |
- [email protected]: | |
title: Production Workflow | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
envman add --key ENVIRONMENT --value "Production" | |
envman add --key IOS_CODE_PUSH_KEY --value $IOS_CODE_PUSH_KEY_PRODUCTION | |
envman add --key ANDROID_CODE_PUSH_KEY --value $ANDROID_CODE_PUSH_KEY_PRODUCTION | |
envman add --key IOS_DISTRIBUTION_TYPE --value "app-store" | |
envman add --key ANDROID_VARIANT --value "release" | |
pull_request: | |
after_run: | |
- setup | |
- setup_ios | |
- test_ios | |
steps: | |
- [email protected]: | |
title: Pull Request Workflow | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
echo "Starting the Pull Request Workflow" | |
primary: | |
after_run: | |
- setup | |
- setup_ios | |
# - setup_android | |
- test_ios | |
# - test_android | |
- archive_ios | |
- deploy_ios | |
# - deploy_android | |
- deploy_bitrise | |
steps: | |
- [email protected]: | |
title: Primary Workflow | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
echo "Starting the Primary Workflow for the ${ENVIRONMENT} Environment." | |
setup: | |
steps: | |
- [email protected]: | |
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' | |
- [email protected]: {} | |
- [email protected]: | |
title: Set RUN_ARCHIVE | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
if [[ "$GIT_CLONE_COMMIT_MESSAGE_SUBJECT" == *"[FULL BUILD]"* ]] || [[ "$ENVIRONMENT" == "Development" ]] | |
then | |
envman add --key RUN_ARCHIVE --value true | |
else | |
envman add --key RUN_ARCHIVE --value false | |
fi | |
- [email protected]: | |
title: Set DEPLOY_ARCHIVE | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
if [[ "$GIT_CLONE_COMMIT_MESSAGE_SUBJECT" == *"[FULL BUILD]"* ]] && [[ "$ENVIRONMENT" != "Development" ]] | |
then | |
envman add --key DEPLOY_ARCHIVE --value true | |
else | |
envman add --key DEPLOY_ARCHIVE --value false | |
fi | |
- [email protected]: | |
title: Set DEPLOY_UPDATE (CodePush and Sentry) | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
if [[ "$ENVIRONMENT" != "Development" ]] | |
then | |
envman add --key DEPLOY_UPDATE --value true | |
else | |
envman add --key DEPLOY_UPDATE --value true | |
fi | |
- [email protected]: | |
title: Set USE_DETOX | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
# TODO: the purpose of this workflow is to determine if USE_DETOX should be true ... | |
# TODO: so first, figure out what is wrong with detox in bitrise environment | |
# TODO: set USE_DETOX to true when applicable (figure out when we want to run the tests) | |
envman add --key USE_DETOX --value false | |
- [email protected]: | |
title: Set Install Native Deps | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
if [ "$RUN_ARCHIVE" = true ] || [ "$USE_DETOX" = true ] | |
then | |
envman add --key INSTALL_NATIVE_DEPS --value true | |
else | |
envman add --key INSTALL_NATIVE_DEPS --value false | |
fi | |
- [email protected]: | |
title: Set Build Description | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
brew install jq | |
LAST_HASH=$(curl -X GET "https://api.bitrise.io/v0.1/apps/ab1dc0a175ba5d60/builds?sort_by=created_at&workflow=staging" -H "accept: application/json" -H "Authorization: $BITRISE_TOKEN" | jq -r '[.data[]|select((.status == 0) or (.status == 1))][0].commit_hash') | |
envman add --key LAST_COMMIT_HASH --value $LAST_HASH | |
- [email protected]: | |
run_if: '{{getenv "USE_DETOX" | ne "true"}}' | |
title: if USE_DETOX != true, then remove detox | |
inputs: | |
- content: | | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
brew install jq | |
echo $(jq "del(.devDependencies.detox)" <<< cat $BITRISE_SOURCE_DIR/package.json) > $BITRISE_SOURCE_DIR/package.json | |
- [email protected]: | |
title: Install npm-cache | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
npm install -g npm-cache | |
- cache-pull: {} | |
- [email protected]: | |
title: npm-cache install | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
npm-cache install --cacheDirectory . | |
- cache-push: | |
inputs: | |
- cache_paths: "./npm" | |
- [email protected]: | |
inputs: | |
- command: install | |
title: npm install | |
- [email protected]: | |
run_if: '{{getenv "USE_DETOX" | eq "true"}}' | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
brew tap wix/brew | |
brew install applesimutils | |
title: Install detox deps (If USE_DETOX == true) | |
- [email protected]: | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
echo "module.exports = $BITRISE_BUILD_NUMBER;" > dist.js | |
title: Set build number in dist.js | |
- npm: | |
title: Install CodePush CLI | |
inputs: | |
- command: install -g code-push-cli | |
setup_ios: | |
steps: | |
- [email protected]: | |
title: iOS Google Services Plist Downloader | |
inputs: | |
- destination: "$BITRISE_SOURCE_DIR/ios/GoogleService-Info.plist" | |
- source: "$BITRISEIO_IOS_GOOGLE_SERVICES_PLIST_URL" | |
- cocoapods-install: | |
run_if: '{{getenv "INSTALL_NATIVE_DEPS" | eq "true"}}' | |
- cache-push: | |
run_if: '{{getenv "INSTALL_NATIVE_DEPS" | eq "true"}}' | |
inputs: | |
- cache_paths: "./ios/Pods -> ./ios/Podfile.lock" | |
- [email protected]: | |
title: Patch Packages | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
# brew install gnu-sed | |
# gsed -i '36i -(dispatch_queue_t)methodQueue { return dispatch_get_main_queue(); }' node_modules/react-native-onesignal/ios/RCTOneSignal/RCTOneSignalEventEmitter.m | |
# gsed -i '6i #import <UIKit/UIKit.h>' node_modules/react-native-inappbrowser-reborn/ios/RNInAppBrowser.h | |
# gsed -i 's/__IPHONE_13_0/130000/g' node_modules/react-native-inappbrowser-reborn/ios/RNInAppBrowser.m | |
npx patch-package | |
setup_android: | |
steps: | |
- [email protected]: | |
title: Android Keystore Downloader | |
inputs: | |
- destination: "$BITRISE_SOURCE_DIR/android/app/sibly.keystore" | |
- source: "$BITRISEIO_ANDROID_KEYSTORE_URL" | |
- [email protected]: | |
title: Android Google Services JSON Downloader | |
inputs: | |
- destination: "$BITRISE_SOURCE_DIR/android/app/google-services.json" | |
- source: "$BITRISEIO_ANDROID_GOOGLE_SERVICES_JSON_URL" | |
- [email protected]: | |
run_if: '{{getenv "INSTALL_NATIVE_DEPS" | eq "true"}}' | |
inputs: | |
- gradlew_path: "$PROJECT_LOCATION/gradlew" | |
- [email protected]: | |
inputs: | |
- command: run android:jetify | |
title: Android jetify | |
- [email protected]: | |
inputs: | |
- path: "$ORIG_WORK_DIR/android" | |
- [email protected]: {} | |
- [email protected]: | |
inputs: | |
- path: "$ORIG_WORK_DIR" | |
test_ios: | |
steps: | |
- [email protected]: | |
title: Run detox tests | |
run_if: '{{getenv "USE_DETOX" | eq "true"}}' | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
echo "Building and running detox" | |
npm run build:e2e | |
npm run ci:test:e2e | |
archive_ios: | |
steps: | |
- [email protected]: | |
title: Inject CodePush deployment key | |
run_if: '{{getenv "DEPLOY_UPDATE" | eq "true"}}' | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
KEY=$IOS_CODE_PUSH_KEY | |
echo "Updating CodePush deploy key to: $KEY" | |
/usr/libexec/PlistBuddy -c "Set :CodePushDeploymentKey $KEY" ios/Sibly/Info.plist | |
- [email protected]: | |
run_if: '{{getenv "RUN_ARCHIVE" | eq "true"}}' | |
inputs: | |
- team_id: LL8G5N933A | |
- distribution_type: "$IOS_DISTRIBUTION_TYPE" | |
- [email protected]: | |
run_if: '{{getenv "RUN_ARCHIVE" | eq "true"}}' | |
inputs: | |
- plist_path: "$BITRISE_SOURCE_DIR/ios/Sibly/Info.plist" | |
- [email protected]: | |
run_if: '{{getenv "RUN_ARCHIVE" | eq "true"}}' | |
inputs: | |
- team_id: "$SIBLY_IOS_TEAM_ID" | |
- export_method: "$IOS_DISTRIBUTION_TYPE" | |
- compile_bitcode: 'no' | |
- upload_bitcode: 'no' | |
- configuration: Release | |
archive_android: | |
steps: | |
- [email protected]: | |
title: Inject CodePush deployment key | |
run_if: '{{getenv "USE_CODEPUSH" | eq "true"}}' | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
brew install xmlstarlet | |
# Eventually to be replaced by an if statement depending on environment | |
KEY=$ANDROID_CODE_PUSH_KEY | |
echo "Updating CodePush deploy key to: $KEY" | |
xmlstarlet ed -L -u "/resources/string[@name=\"reactNativeCodePush_androidDeploymentKey\"]" -v $KEY android/app/src/main/res/values/strings.xml | |
xmlstarlet ed -L -u "/resources/string[@name=\"CodePushDeploymentKey\"]" -v $KEY android/app/src/main/res/values/strings.xml | |
- [email protected]: | |
run_if: '{{getenv "RUN_ARCHIVE" | eq "true"}}' | |
inputs: | |
- path: "$ORIG_WORK_DIR/android" | |
- [email protected]: | |
title: Bundle & assemble Android release | |
run_if: '{{getenv "RUN_ARCHIVE" | eq "true"}}' | |
inputs: | |
- gradlew_path: "./gradlew" | |
- gradle_task: bundleRelease assembleRelease | |
- [email protected]: | |
run_if: '{{getenv "RUN_ARCHIVE" | eq "true"}}' | |
inputs: | |
- path: "$ORIG_WORK_DIR" | |
- cache-push: | |
inputs: | |
- cache_paths: |- | |
$HOME/.gradle | |
./android/.gradle | |
- ignore_check_on_paths: |- | |
$HOME/.gradle/caches/*.lock | |
./android/.gradle/*.lock | |
./android/.gradle/*.bin | |
deploy_ios: | |
steps: | |
- [email protected]: | |
title: CodePush Release iOS | |
run_if: '{{getenv "DEPLOY_UPDATE" | eq "true"}}' | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
BUILD_DESCRIPTION=$(git log $LAST_COMMIT_HASH..$BITRISE_GIT_COMMIT --format=%B | sed '/^$/d') | |
if [ "$LAST_COMMIT_HASH" = "$BITRISE_GIT_COMMIT" ]; then | |
BUILD_DESCRIPTION=$(git log -1 --format=%B | sed '/^$/d') | |
fi | |
if [ -z "$BUILD_DESCRIPTION" ]; then | |
echo "No messages found to apply to build description"; | |
BUILD_DESCRIPTION="- No build description found" | |
fi | |
if which appcenter > /dev/null; then | |
echo "AppCenter CLI already installed." | |
else | |
echo "AppCenter CLI is not installed. Installing..." | |
npm install -g appcenter-cli | |
fi | |
appcenter codepush release-react -a $IOS_CODE_PUSH_APP_ID --token $APPCENTER_ACCESS_TOKEN --quiet --output-dir ./build --deployment-name $ENVIRONMENT --description "\n$BUILD_DESCRIPTION" | |
- [email protected]: | |
title: Update Sentry bundle | |
run_if: '{{getenv "DEPLOY_UPDATE" | eq "true"}}' | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
npm install @sentry/cli | |
BUILD_DIR="codePush" | |
if [ -d "build/CodePush" ]; then | |
BUILD_DIR="CodePush" | |
fi | |
# TODO: DEPLOY_ENVIRONMENT="staging" | |
SENTRY_AUTH_TOKEN=$SENTRY_TOKEN SENTRY_PROPERTIES="ios/sentry.properties" $(npm bin)/sentry-cli react-native appcenter $IOS_CODE_PUSH_APP_ID ios "./build/$BUILD_DIR" | |
- deploy-to-itunesconnect-application-loader@0: | |
run_if: '{{getenv "DEPLOY_ARCHIVE" | eq "true"}}' | |
inputs: | |
- password: "$SIBLY_APPLE_ID_PASSWORD" | |
- app_password: "$SIBLY_IOS_TYPHON_PASSWORD" | |
- itunescon_user: "$SIBLY_APPLE_ID" | |
- deploy-to-itunesconnect-deliver@2: | |
run_if: '{{getenv "DEPLOY_ARCHIVE" | eq "true"}}' | |
inputs: | |
- password: "$SIBLY_APPLE_ID_PASSWORD" | |
- app_password: "$SIBLY_IOS_TYPHON_PASSWORD" | |
- team_id: "$SIBLY_IOS_TEAM_ID" | |
- itunescon_user: "$SIBLY_APPLE_ID" | |
deploy_android: | |
steps: | |
- [email protected]: | |
title: CodePush Release Android | |
run_if: '{{getenv "DEPLOY_UPDATE" | eq "true"}}' | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
BUILD_DESCRIPTION=$(git log $LAST_COMMIT_HASH..$BITRISE_GIT_COMMIT --format=%B | sed '/^$/d') | |
if [ "$LAST_COMMIT_HASH" = "$BITRISE_GIT_COMMIT" ]; then | |
BUILD_DESCRIPTION=$(git log -1 --format=%B | sed '/^$/d') | |
fi | |
if [ -z "$BUILD_DESCRIPTION" ]; then | |
echo "No messages found to apply to build description"; | |
BUILD_DESCRIPTION="- No build description found" | |
fi | |
if which appcenter > /dev/null; then | |
echo "AppCenter CLI already installed." | |
else | |
echo "AppCenter CLI is not installed. Installing..." | |
npm install -g appcenter-cli | |
fi | |
appcenter codepush release-react -a $ANDROID_CODE_PUSH_APP_ID --token $APPCENTER_ACCESS_TOKEN --quiet --output-dir ./build --deployment-name $ENVIRONMENT --description "\n$BUILD_DESCRIPTION" | |
- [email protected]: | |
title: Update Sentry bundle | |
run_if: '{{getenv "DEPLOY_UPDATE" | eq "true"}}' | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
npm install @sentry/cli | |
BUILD_DIR="codePush" | |
if [ -d "build/CodePush" ]; then | |
BUILD_DIR="CodePush" | |
fi | |
# TODO: DEPLOY_ENVIRONMENT="staging" | |
SENTRY_AUTH_TOKEN=$SENTRY_TOKEN SENTRY_PROPERTIES="android/sentry.properties" $(npm bin)/sentry-cli react-native appcenter $ANDROID_CODE_PUSH_APP_ID android "./build/$BUILD_DIR" | |
deploy_bitrise: | |
steps: | |
- [email protected]: | |
run_if: '{{getenv "RUN_ARCHIVE" | eq "true"}}' | |
app: | |
envs: | |
- opts: | |
is_expand: false | |
PROJECT_LOCATION: android | |
- opts: | |
is_expand: false | |
MODULE: app | |
- opts: | |
is_expand: false | |
VARIANT: debug | |
- opts: | |
is_expand: false | |
BITRISE_PROJECT_PATH: ios/Sibly.xcworkspace | |
- opts: | |
is_expand: false | |
BITRISE_SCHEME: Sibly | |
- opts: | |
is_expand: false | |
BITRISE_EXPORT_METHOD: development | |
- ORIG_WORK_DIR: "$BITRISE_SOURCE_DIR" | |
- opts: | |
is_expand: false | |
USE_DETOX: 'false' | |
- opts: | |
is_expand: false | |
SENTRY_ORG: siblyco | |
- opts: | |
is_expand: false | |
IOS_CODE_PUSH_APP_ID: Sibly/Typhon-iOS | |
- opts: | |
is_expand: false | |
ANDROID_CODE_PUSH_APP_ID: Sibly/Typhon-Android | |
meta: | |
bitrise.io: | |
machine_type: standard |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment