Created
April 8, 2020 19:17
-
-
Save cgradwohl/c4278bb7cc5eda4b958c8544c979167e to your computer and use it in GitHub Desktop.
new pipelinee update 12:16, tuesday
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 | |
workflows: | |
setup: | |
steps: | |
- activate-ssh-key@4.0.3: | |
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' | |
- git-clone@4.0.14: {} | |
- script@1.1.5: | |
title: Set Full Build | |
inputs: | |
- content: |- | |
#!/bin/bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
if [[ "$GIT_CLONE_COMMIT_MESSAGE_SUBJECT" == *"[FULL BUILD]"* ]] | |
then | |
envman add --key RUN_ARCHIVE --value true | |
else | |
envman add --key RUN_ARCHIVE --value false | |
fi | |
- script@1.1.5: | |
title: Set Install Native Deps | |
inputs: | |
- content: |- | |
#!/bin/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 | |
- script@1.1.5: | |
title: Set Build Description | |
inputs: | |
- content: |- | |
#!/bin/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 | |
- script@1.1.5: | |
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 | |
- script@1.1.5: | |
title: Install npm-cache | |
inputs: | |
- content: |- | |
#!/bin/bash | |
npm install -g npm-cache | |
- cache-pull: {} | |
- script@1.1.3: | |
title: npm-cache install | |
inputs: | |
- content: |- | |
#!/bin/bash | |
npm-cache install --cacheDirectory . | |
- cache-push: | |
inputs: | |
- cache_paths: "./npm" | |
- npm@1.0.2: | |
inputs: | |
- command: install | |
title: npm install | |
- script@1.1.5: | |
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: If USE_DETOX == true, then install detox deps | |
- script@1.1.5: | |
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: | |
- file-downloader@1.0.1: | |
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" | |
- script@1.1.5: | |
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 | |
test_ios: | |
steps: | |
- script@1.1.5: | |
run_if: '{{getenv "USE_DETOX" | eq "true"}}' | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
# write your script here | |
echo "Building and running detox" | |
npm run build:e2e | |
npm run ci:test:e2e | |
title: Run detox tests | |
archive_ios: | |
steps: | |
- script@1.1.6: | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
# Eventually to be replaced by an if statement depending on environment | |
KEY=$CODE_PUSH_KEY_STAGING | |
echo "Updating CodePush deploy key to: $KEY" | |
/usr/libexec/PlistBuddy -c "Set :CodePushDeploymentKey $KEY" ios/Sibly/Info.plist | |
title: Inject CodePush deployment key | |
- ios-auto-provision@1.4.1: | |
run_if: '{{getenv "RUN_ARCHIVE" | eq "true"}}' | |
inputs: | |
- team_id: LL8G5N933A | |
- distribution_type: "$IOS_EXPORT_METHOD" | |
- set-xcode-build-number@1.0.8: | |
run_if: '{{getenv "RUN_ARCHIVE" | eq "true"}}' | |
inputs: | |
- plist_path: "$BITRISE_SOURCE_DIR/ios/Sibly/Info.plist" | |
- xcode-archive@2.7.0: | |
run_if: '{{getenv "RUN_ARCHIVE" | eq "true"}}' | |
inputs: | |
- team_id: LL8G5N933A | |
- export_method: "$IOS_EXPORT_METHOD" | |
- compile_bitcode: 'no' | |
- upload_bitcode: 'no' | |
- configuration: Release | |
- script@1.1.6: | |
title: CodePush Release iOS | |
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 $CODE_PUSH_APP_ID --token $APPCENTER_ACCESS_TOKEN --quiet --output-dir ./build --deployment-name $ENVIRONMENT --description "\n$BUILD_DESCRIPTION" | |
- script@1.1.6: | |
title: Update Sentry bundle | |
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 | |
# DEPLOY_ENVIRONMENT="staging" | |
SENTRY_AUTH_TOKEN=$SENTRY_TOKEN SENTRY_PROPERTIES="ios/sentry.properties" $(npm bin)/sentry-cli react-native appcenter $CODE_PUSH_APP_ID ios "./build/$BUILD_DIR" | |
envs: | |
- opts: | |
is_expand: false | |
CODE_PUSH_KEY_STAGING: iLv4Pzi8NE7PhqM38m0br5sOjqn8xp36MtRGJ | |
- opts: | |
is_expand: false | |
CODE_PUSH_KEY_PRODUCTION: 7XwknkTUErxKmRQFODTZ7EOPjQBPuyaIM3gsT | |
- opts: | |
is_expand: false | |
CODE_PUSH_APP_ID: work-mtnm/Typhon-iOS | |
setup_android: | |
steps: | |
- file-downloader@1.0.1: | |
title: Android Keystore Downloader | |
inputs: | |
- destination: "$BITRISE_SOURCE_DIR/android/app/sibly.keystore" | |
- source: "$BITRISEIO_ANDROID_KEYSTORE_URL" | |
- file-downloader@1.0.1: | |
title: Android Google Services JSON Downloader | |
inputs: | |
- destination: "$BITRISE_SOURCE_DIR/android/app/google-services.json" | |
- source: "$BITRISEIO_ANDROID_GOOGLE_SERVICES_JSON_URL" | |
- install-missing-android-tools@2.3.5: | |
run_if: '{{getenv "INSTALL_NATIVE_DEPS" | eq "true"}}' | |
inputs: | |
- gradlew_path: "$PROJECT_LOCATION/gradlew" | |
- npm@1.0.2: | |
inputs: | |
- command: run android:jetify | |
title: Android jetify | |
- change-workdir@1.0.2: | |
inputs: | |
- path: "$ORIG_WORK_DIR/android" | |
- change-android-versioncode-and-versionname@1.1.1: {} | |
- change-workdir@1.0.2: | |
inputs: | |
- path: "$ORIG_WORK_DIR" | |
archive_android: | |
steps: | |
- script@1.1.6: | |
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=$CODE_PUSH_KEY_STAGING | |
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 | |
title: Inject CodePush deployment key | |
- change-workdir@1.0.2: | |
run_if: '{{getenv "RUN_ARCHIVE" | eq "true"}}' | |
inputs: | |
- path: "$ORIG_WORK_DIR/android" | |
- gradle-runner@1.9.0: | |
run_if: '{{getenv "RUN_ARCHIVE" | eq "true"}}' | |
inputs: | |
- gradlew_path: "./gradlew" | |
- gradle_task: bundleRelease assembleRelease | |
title: Bundle & assemble Android release | |
- change-workdir@1.0.2: | |
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 | |
- script@1.1.6: | |
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 $CODE_PUSH_APP_ID --token $APPCENTER_ACCESS_TOKEN --quiet --output-dir ./build --deployment-name $ENVIRONMENT --description "\n$BUILD_DESCRIPTION" | |
title: CodePush Release Android | |
- script@1.1.6: | |
title: Update Sentry bundle | |
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 | |
# DEPLOY_ENVIRONMENT="staging" | |
SENTRY_AUTH_TOKEN=$SENTRY_TOKEN SENTRY_PROPERTIES="android/sentry.properties" $(npm bin)/sentry-cli react-native appcenter $CODE_PUSH_APP_ID android "./build/$BUILD_DIR" | |
envs: | |
# - opts: | |
# is_expand: false | |
# CODE_PUSH_KEY_STAGING: ZWKLUAdxJ78PuaoOxE4RUkAG8ia8865k-76DA | |
# - opts: | |
# is_expand: false | |
# CODE_PUSH_KEY_PRODUCTION: NQcVxqrOrXtk7Y5qQKEG7pUXIiOo7Snc0qM9i | |
# - opts: | |
# is_expand: false | |
# CODE_PUSH_APP_ID: work-mtnm/Typhon-Android | |
deploy: | |
steps: | |
- deploy-to-bitrise-io@1.6.0: | |
run_if: '{{getenv "RUN_ARCHIVE" | eq "true"}}' | |
production: | |
after_run: | |
- primary | |
steps: | |
- script@1.1.3: | |
title: Set Production Environment | |
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_EXPORT_METHOD --value "app-store" | |
envman add --key ANDROID_VARIANT --value "release" | |
staging: | |
after_run: | |
- primary | |
steps: | |
- script@1.1.3: | |
title: Set Staging Environment | |
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_PRODUCTION | |
envman add --key ANDROID_CODE_PUSH_KEY --value $ANDROID_CODE_PUSH_KEY_PRODUCTION | |
envman add --key IOS_EXPORT_METHOD --value "ad-hoc" | |
envman add --key ANDROID_VARIANT --value "release" | |
development: | |
after_run: | |
- primary | |
steps: | |
- script@1.1.3: | |
title: Set Development Environment | |
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_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_EXPORT_METHOD --value "ad-hoc" | |
envman add --key ANDROID_VARIANT --value "debug" | |
primary: | |
before_run: | |
- setup | |
# - setup_ios | |
# - test_ios | |
# - setup_android | |
# after_run: | |
# - archive_ios | |
# - archive_android | |
# - deploy | |
steps: | |
- script@1.1.3: | |
title: Primary Workflow | |
inputs: | |
- content: | | |
#!/bin/bash | |
echo "ENVIRONMENT: ${ENVIRONMENT}" | |
echo "IOS_CODE_PUSH_KEY: ${IOS_CODE_PUSH_KEY}" | |
echo "ANDROID_CODE_PUSH_KEY: ${ANDROID_CODE_PUSH_KEY}" | |
echo "IOS_EXPORT_METHOD: ${IOS_EXPORT_METHOD}" | |
# staging: | |
# before_run: | |
# - setup | |
# - setup_ios | |
# - test_ios | |
# - setup_android | |
# after_run: | |
# - archive_ios | |
# - archive_android | |
# - deploy | |
# steps: | |
# - script@1.1.3: | |
# title: Set ENVIRONMENT | |
# 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_EXPORT_METHOD --value "ad-hoc" | |
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