Created
March 23, 2018 16:04
-
-
Save birkir/e4b973ebdbee09e2731c724b5e20b46f to your computer and use it in GitHub Desktop.
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: '4' | |
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git | |
project_type: fastlane | |
app: | |
envs: | |
- FASTLANE_XCODE_LIST_TIMEOUT: '120' | |
- opts: | |
is_expand: false | |
FASTLANE_WORK_DIR: android | |
- IOS_BUNDLE_ID: com.corp.appname | |
- IOS_CODEPUSH_DEPLOYMENT_KEY: *** | |
- IOS_CODEPUSH_DEPLOYMENT_KEY_STAGING: *** | |
- IOS_CODEPUSH_APPID: AppNameIOS | |
- ANDROID_BUNDLE_ID: com.corp.appname | |
- ANDROID_CODEPUSH_APPID: AppNameAndroid | |
- ANDROID_CODEPUSH_DEPLOYMENT_KEY: *** | |
- ANDROID_CODEPUSH_DEPLOYMENT_KEY_STAGING: *** | |
- ANDROID_KEYSTORE_ALIAS: release | |
- SENTRY_DSN: https://***:***@sentry.io/*** | |
- SENTRY_ORG: organization-name | |
- SENTRY_PROJECT: app-name | |
trigger_map: | |
- push_branch: master | |
workflow: primary | |
- pull_request_source_branch: "*" | |
workflow: primary | |
workflows: | |
primary: | |
steps: | |
- activate-ssh-key@3.1.1: | |
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' | |
- git-clone@4.0.5: {} | |
- cache-pull@2.0.1: {} | |
- script@1.1.5: | |
title: Detect full builds | |
inputs: | |
- content: "#!/usr/bin/env bash\nBUILD_ANDROID=0\nBUILD_IOS=0\n\n## Determine | |
what to build on which matrix lane\n## ============================================\n\nif | |
[[ \"$BITRISE_GIT_BRANCH\" == \"master\" ]]; then\n\n # Find last successfully | |
built android and ios commits\n LAST_ANDROID=$(git log --grep='\\[bitrise-android\\]' | |
-1 | grep -o -E -e \"[0-9a-f]{40}\")\n LAST_IOS=$(git log --grep='\\[bitrise-ios\\]' | |
-1 | grep -o -E -e \"[0-9a-f]{40}\")\n\n if [[ \"$LAST_ANDROID\" == \"\" | |
]]; then\n echo \"Warning: No previous [Android] built on bitrise\"\n | |
\ LAST_ANDROID=$(git log --max-parents=0 HEAD | grep -o -E -e \"[0-9a-f]{40}\")\n | |
\ fi\n\n if [[ \"$LAST_IOS\" == \"\" ]]; then\n echo \"Warning: No | |
previous [iOS] built on bitrise\"\n LAST_IOS=$(git log --max-parents=0 | |
HEAD | grep -o -E -e \"[0-9a-f]{40}\")\n fi\n\n # Get list of files | |
changed since last successful builds\n TRIGGER_ANDROID=$(git rev-list | |
$LAST_ANDROID..$BITRISE_GIT_COMMIT | xargs -L1 git diff-tree --no-commit-id | |
--name-only -r | grep \"^android\")\n TRIGGER_IOS=$(git rev-list $LAST_IOS..$BITRISE_GIT_COMMIT | |
| xargs -L1 git diff-tree --no-commit-id --name-only -r | grep \"^ios\")\n | |
\ \n # Get list of commit messages including [BUILD] since last successful | |
build\n TRIGGER_ANDROID_BUILD=\"$(git rev-list $LAST_ANDROID..$BITRISE_GIT_COMMIT | |
| xargs -L1 git rev-list --format=%B --max-count=1 | grep \"\\[BUILD\\( | |
ANDROID\\)\\?\\]\")\"\n TRIGGER_IOS_BUILD=\"$(git rev-list $LAST_IOS..$BITRISE_GIT_COMMIT | |
| xargs -L1 git rev-list --format=%B --max-count=1 | grep \"\\[BUILD\\( | |
IOS\\)\\?\\]\")\"\n\n if [[ \"$TRIGGER_ANDROID\" != \"\" ]]; then\n BUILD_ANDROID=1\n | |
\ fi\n\n if [[ \"$TRIGGER_IOS\" != \"\" ]]; then\n BUILD_IOS=1\n fi\n\n | |
\ if [[ \"$TRIGGER_ANDROID_BUILD\" != \"\" ]]; then\n BUILD_ANDROID=1\n | |
\ fi\n\n if [[ \"$TRIGGER_IOS_BUILD\" != \"\" ]]; then\n BUILD_IOS=1\n | |
\ fi\nfi\n\nenvman add --key BUILD_IOS --value $BUILD_IOS\nenvman add | |
--key BUILD_ANDROID --value $BUILD_ANDROID\n\nexit 0" | |
- script@1.1.5: | |
title: Setup environment | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
echo "[Environment] BUILD_ANDROID: $BUILD_ANDROID" | |
echo "[Environment] BUILD_IOS: $BUILD_IOS" | |
echo "[Environment] Creating .env file" | |
for KEY in $(cat .env_example | sed 's/\"/\\\"/g' | sed -n 's|\(.*\)=\(.*\)|\1|p'); do | |
echo "$KEY=$(printf '%s\n' "${!KEY}")" >> .env | |
done | |
# Generate secret files | |
if [ ! -z "$MATCH_PASSWORD" ]; then | |
set -ex | |
echo "[Environment] Generating secret files" | |
gpg --version | |
gpg --batch --passphrase $MATCH_PASSWORD --decrypt .travis/secrets.zip.gpg > .travis/secrets.zip | |
unzip -o .travis/secrets.zip -d ./ | |
fi | |
# Install sentry cli | |
curl -sL https://sentry.io/get-cli/ | bash | |
- npm@0.9.0: | |
inputs: | |
- command: install -g react-native-cli code-push-cli | |
title: npm install -g | |
- yarn@0.0.4: | |
inputs: | |
- command: install | |
title: yarn install | |
- yarn@0.0.4: | |
inputs: | |
- command: lint | |
title: yarn lint | |
- yarn@0.0.4: | |
inputs: | |
- command: test | |
title: yarn test | |
- fastlane@2.3.12: | |
inputs: | |
- lane: bitrise | |
- work_dir: "$FASTLANE_WORK_DIR" | |
- cache-push@2.0.3: | |
inputs: | |
- cache_paths: |- | |
$YARN_CACHE_DIR | |
node_modules | |
is_always_run: true | |
- script@1.1.5: | |
title: Code Push | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
# fail if any commands fails | |
if [[ "$BUILD_ANDROID" == "0" ]]; then | |
set -ex | |
# Login to code-push | |
code-push login --accessKey $CODEPUSH_ACCESS_KEY | |
# Release code-push | |
code-push release-react $ANDROID_CODEPUSH_APPID android --outputDir build --description "$BITRISE_GIT_MESSAGE" | |
# Upload source-maps | |
sentry-cli react-native codepush $ANDROID_CODEPUSH_APPID android ./build --bundle-id $ANDROID_BUNDLE_ID | |
else | |
echo "Not releasing code-push" | |
fi | |
- deploy-to-bitrise-io@1.3.10: {} |
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: '4' | |
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git | |
project_type: fastlane | |
app: | |
envs: | |
- FASTLANE_XCODE_LIST_TIMEOUT: '120' | |
- opts: | |
is_expand: false | |
FASTLANE_WORK_DIR: ios | |
- IOS_BUNDLE_ID: com.corp.appname | |
- IOS_CODEPUSH_DEPLOYMENT_KEY: *** | |
- IOS_CODEPUSH_DEPLOYMENT_KEY_STAGING: *** | |
- IOS_CODEPUSH_APPID: AppNameIOS | |
- ANDROID_BUNDLE_ID: com.corp.appname | |
- ANDROID_CODEPUSH_APPID: AppNameAndroid | |
- ANDROID_CODEPUSH_DEPLOYMENT_KEY: *** | |
- ANDROID_CODEPUSH_DEPLOYMENT_KEY_STAGING: *** | |
- ANDROID_KEYSTORE_ALIAS: release | |
- SENTRY_DSN: https://***:***@sentry.io/*** | |
- SENTRY_ORG: organization-name | |
- SENTRY_PROJECT: app-name | |
trigger_map: | |
- push_branch: master | |
workflow: primary | |
- pull_request_source_branch: "*" | |
workflow: primary | |
workflows: | |
primary: | |
steps: | |
- activate-ssh-key@3.1.1: | |
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' | |
- git-clone@4.0.5: {} | |
- cache-pull@2.0.1: {} | |
- brew-install@0.9.0: | |
inputs: | |
- packages: gpg | |
- script@1.1.5: | |
title: Detect full builds | |
inputs: | |
- content: "#!/usr/bin/env bash\nBUILD_ANDROID=0\nBUILD_IOS=0\n\n## Determine | |
what to build on which matrix lane\n## ============================================\n\nif | |
[[ \"$BITRISE_GIT_BRANCH\" == \"master\" ]]; then\n\n # Find last successfully | |
built android and ios commits\n LAST_ANDROID=$(git log --grep='\\[bitrise-android\\]' | |
-1 | grep -o -E -e \"[0-9a-f]{40}\")\n LAST_IOS=$(git log --grep='\\[bitrise-ios\\]' | |
-1 | grep -o -E -e \"[0-9a-f]{40}\")\n\n if [[ \"$LAST_ANDROID\" == \"\" | |
]]; then\n echo \"Warning: No previous [Android] built on bitrise\"\n | |
\ LAST_ANDROID=$(git log --max-parents=0 HEAD | grep -o -E -e \"[0-9a-f]{40}\")\n | |
\ fi\n\n if [[ \"$LAST_IOS\" == \"\" ]]; then\n echo \"Warning: No | |
previous [iOS] built on bitrise\"\n LAST_IOS=$(git log --max-parents=0 | |
HEAD | grep -o -E -e \"[0-9a-f]{40}\")\n fi\n\n # Get list of files | |
changed since last successful builds\n TRIGGER_ANDROID=$(git rev-list | |
$LAST_ANDROID..$BITRISE_GIT_COMMIT | xargs -L1 git diff-tree --no-commit-id | |
--name-only -r | grep \"^android\")\n TRIGGER_IOS=$(git rev-list $LAST_IOS..$BITRISE_GIT_COMMIT | |
| xargs -L1 git diff-tree --no-commit-id --name-only -r | grep \"^ios\")\n | |
\ \n # Get list of commit messages including [BUILD] since last successful | |
build\n TRIGGER_ANDROID_BUILD=\"$(git rev-list $LAST_ANDROID..$BITRISE_GIT_COMMIT | |
| xargs -L1 git rev-list --format=%B --max-count=1 | grep \"\\[BUILD\\( | |
ANDROID\\)\\?\\]\")\"\n TRIGGER_IOS_BUILD=\"$(git rev-list $LAST_IOS..$BITRISE_GIT_COMMIT | |
| xargs -L1 git rev-list --format=%B --max-count=1 | grep \"\\[BUILD\\( | |
IOS\\)\\?\\]\")\"\n\n if [[ \"$TRIGGER_ANDROID\" != \"\" ]]; then\n BUILD_ANDROID=1\n | |
\ fi\n\n if [[ \"$TRIGGER_IOS\" != \"\" ]]; then\n BUILD_IOS=1\n fi\n\n | |
\ if [[ \"$TRIGGER_ANDROID_BUILD\" != \"\" ]]; then\n BUILD_ANDROID=1\n | |
\ fi\n\n if [[ \"$TRIGGER_IOS_BUILD\" != \"\" ]]; then\n BUILD_IOS=1\n | |
\ fi\nfi\n\nenvman add --key BUILD_IOS --value $BUILD_IOS\nenvman add | |
--key BUILD_ANDROID --value $BUILD_ANDROID\n\nexit 0" | |
- script@1.1.5: | |
title: Setup environment | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
echo "[Environment] BUILD_ANDROID: $BUILD_ANDROID" | |
echo "[Environment] BUILD_IOS: $BUILD_IOS" | |
echo "[Environment] Creating .env file" | |
for KEY in $(cat .env_example | sed 's/\"/\\\"/g' | sed -n 's|\(.*\)=\(.*\)|\1|p'); do | |
echo "$KEY=$(printf '%s\n' "${!KEY}")" >> .env | |
done | |
# Generate secret files | |
if [ ! -z "$MATCH_PASSWORD" ]; then | |
set -ex | |
echo "[Environment] Generating secret files" | |
gpg --version | |
gpg --batch --passphrase $MATCH_PASSWORD --decrypt .travis/secrets.zip.gpg > .travis/secrets.zip | |
unzip -o .travis/secrets.zip -d ./ | |
fi | |
is_always_run: true | |
- npm@0.9.0: | |
inputs: | |
- command: install -g react-native-cli @sentry/cli code-push-cli | |
title: npm install -g | |
- npm@0.9.0: | |
inputs: | |
- command: install | |
title: npm install | |
- script@1.1.5: | |
title: Postinstall | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
set -ex | |
cat ./scripts/postinstall.sh | sh | |
- cocoapods-install@1.7.2: {} | |
- npm@0.9.0: | |
inputs: | |
- command: run lint | |
title: lint | |
- npm@0.9.0: | |
inputs: | |
- command: run test | |
title: test | |
- fastlane@2.3.12: | |
inputs: | |
- lane: bitrise | |
- work_dir: "$FASTLANE_WORK_DIR" | |
- script@1.1.5: | |
title: Code Push | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
if [[ "$BUILD_IOS" == "0" ]]; then | |
set -ex | |
# Login to code-push | |
code-push login --accessKey $CODEPUSH_ACCESS_KEY | |
# Release code-push | |
code-push release-react $IOS_CODEPUSH_APPID ios --outputDir build --description "$BITRISE_GIT_MESSAGE" --plistFile ./ios/react-native-starter/Info.plist | |
# Upload source-maps | |
sentry-cli react-native codepush $IOS_CODEPUSH_APPID ios ./build --bundle-id $IOS_BUNDLE_ID | |
else | |
echo "Not releasing code-push" | |
fi | |
- cache-push@2.0.3: | |
inputs: | |
- cache_paths: |- | |
$YARN_CACHE_DIR | |
node_modules | |
is_always_run: true | |
- deploy-to-bitrise-io@1.3.10: {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment