Skip to content

Instantly share code, notes, and snippets.

@madsleejensen
Created July 4, 2017 10:22
Show Gist options
  • Save madsleejensen/b4f428de6e49ff905a6b8067a407bf34 to your computer and use it in GitHub Desktop.
Save madsleejensen/b4f428de6e49ff905a6b8067a407bf34 to your computer and use it in GitHub Desktop.
format_version: '3'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: fastlane
app:
envs:
- FASTLANE_XCODE_LIST_TIMEOUT: '120'
- SOURCE_DIR: $BITRISE_SOURCE_DIR
- MOBILE_DIR: $BITRISE_SOURCE_DIR/mobile
- MOBILE_BUILD_DIR: $BITRISE_SOURCE_DIR/mobile/build/
- MOBILE_IOS_DIR: $BITRISE_SOURCE_DIR/mobile/ios
- CONNECTEDCARS_RELEASE_STORE_FILE: $BITRISE_SOURCE_DIR/mobile/android/connectedcars.keystore
workflows:
_setup_bitrise_environment:
steps:
- activate-ssh-key@3.1.1:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@3.5.0: {}
- script@1.1.4:
title: 'determine if build should be skipped'
inputs:
- content: |-
#!/bin/bash
if [ $(git diff --name-only HEAD~1 | grep -c "mobile/") -eq 0 ]
then
echo ""
envman add --key SHOULD_RUN_BUILD --value "false"
else
envman add --key SHOULD_RUN_BUILD --value "true"
fi
_setup_common_dependencies:
steps:
- change-workdir@1.0.1:
run_if: '{{getenv "SHOULD_RUN_BUILD" | ne "false"}}'
inputs:
- path: $MOBILE_DIR
- yarn@0.0.4:
run_if: '{{getenv "SHOULD_RUN_BUILD" | ne "false"}}'
- install-react-native@0.9.1:
run_if: '{{getenv "SHOULD_RUN_BUILD" | ne "false"}}'
inputs:
- version: 2.0.1
- change-workdir@1.0.1:
run_if: '{{getenv "SHOULD_RUN_BUILD" | ne "false"}}'
inputs:
- path: $SOURCE_DIR
_setup_dockertoolbox:
steps:
- script@1.1.4:
title: install docker-toolbox + virtualbox
run_if: '{{getenv "SHOULD_RUN_BUILD" | ne "false"}}'
inputs:
- content: |-
#!/bin/bash
set -ex
brew cask install virtualbox
brew cask install docker-toolbox
- script@1.1.4:
title: 'docker-machine create default'
run_if: '{{getenv "SHOULD_RUN_BUILD" | ne "false"}}'
inputs:
- content: docker-machine create default
_generate_translation_files_unix:
steps:
- script@1.1.4:
title: 'generate translation files'
run_if: '{{getenv "SHOULD_RUN_BUILD" | ne "false"}}'
inputs:
- working_dir: $SOURCE_DIR
- content: docker run --workdir /app -v $SOURCE_DIR/web:/app -v $SOURCE_DIR/mobile:/app/mobile node:8.1.2 bash -c "curl https://connectedcars.dk/rawtranslations | node generatetranslationfiles.js"
_generate_translation_files_osx:
steps:
- script@1.1.4:
title: 'generate translation files'
run_if: '{{getenv "SHOULD_RUN_BUILD" | ne "false"}}'
inputs:
- working_dir: $SOURCE_DIR
- content: |-
#!/bin/bash
set -ex
eval $(docker-machine env default)
docker run --workdir /app -v $SOURCE_DIR/web:/app -v $SOURCE_DIR/mobile:/app/mobile node:8.1.2 bash -c "curl https://connectedcars.dk/rawtranslations | node generatetranslationfiles.js"
_store_build_artifacts:
steps:
- deploy-to-bitrise-io@1.3.5:
run_if: '{{getenv "SHOULD_RUN_BUILD" | ne "false"}}'
inputs:
- deploy_path: $MOBILE_BUILD_DIR
- is_compress: 'true'
android:
before_run:
- _setup_bitrise_environment
- _setup_common_dependencies
- _generate_translation_files_unix
steps:
- file-downloader@0.9.1:
inputs:
- source: $BITRISEIO_ANDROID_RELEASE_KEYSTORE_URL
- destination: $CONNECTEDCARS_RELEASE_STORE_FILE
- change-workdir@1.0.1:
inputs:
- path: $MOBILE_DIR
- fastlane@2.3.9:
inputs:
- lane: android build_release variant:Volkswagen
after_run:
- _store_build_artifacts
ios:
before_run:
- _setup_bitrise_environment
- _setup_common_dependencies
- _setup_dockertoolbox
- _generate_translation_files_osx
steps:
- certificate-and-profile-installer@1.8.6:
run_if: '{{getenv "SHOULD_RUN_BUILD" | ne "false"}}'
- change-workdir@1.0.1:
run_if: '{{getenv "SHOULD_RUN_BUILD" | ne "false"}}'
inputs:
- path: $MOBILE_IOS_DIR
- carthage@3.1.2:
run_if: '{{getenv "SHOULD_RUN_BUILD" | ne "false"}}'
inputs:
- github_access_token: $GITHUB_ACCESS_TOKEN
- carthage_command: bootstrap
- change-workdir@1.0.1:
run_if: '{{getenv "SHOULD_RUN_BUILD" | ne "false"}}'
inputs:
- path: $MOBILE_DIR
- fastlane@2.3.9:
run_if: '{{getenv "SHOULD_RUN_BUILD" | ne "false"}}'
inputs:
- lane: ios build_release variant:Volkswagen
after_run:
- _store_build_artifacts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment