Created
March 23, 2018 16:04
-
-
Save birkir/e4b973ebdbee09e2731c724b5e20b46f to your computer and use it in GitHub Desktop.
This file contains hidden or 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: | |
- [email protected]: | |
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' | |
- [email protected]: {} | |
- [email protected]: {} | |
- [email protected]: | |
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" | |
- [email protected]: | |
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 | |
- [email protected]: | |
inputs: | |
- command: install -g react-native-cli code-push-cli | |
title: npm install -g | |
- [email protected]: | |
inputs: | |
- command: install | |
title: yarn install | |
- [email protected]: | |
inputs: | |
- command: lint | |
title: yarn lint | |
- [email protected]: | |
inputs: | |
- command: test | |
title: yarn test | |
- [email protected]: | |
inputs: | |
- lane: bitrise | |
- work_dir: "$FASTLANE_WORK_DIR" | |
- [email protected]: | |
inputs: | |
- cache_paths: |- | |
$YARN_CACHE_DIR | |
node_modules | |
is_always_run: true | |
- [email protected]: | |
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 | |
- [email protected]: {} |
This file contains hidden or 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: | |
- [email protected]: | |
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' | |
- [email protected]: {} | |
- [email protected]: {} | |
- [email protected]: | |
inputs: | |
- packages: gpg | |
- [email protected]: | |
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" | |
- [email protected]: | |
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 | |
- [email protected]: | |
inputs: | |
- command: install -g react-native-cli @sentry/cli code-push-cli | |
title: npm install -g | |
- [email protected]: | |
inputs: | |
- command: install | |
title: npm install | |
- [email protected]: | |
title: Postinstall | |
inputs: | |
- content: |- | |
#!/usr/bin/env bash | |
set -ex | |
cat ./scripts/postinstall.sh | sh | |
- [email protected]: {} | |
- [email protected]: | |
inputs: | |
- command: run lint | |
title: lint | |
- [email protected]: | |
inputs: | |
- command: run test | |
title: test | |
- [email protected]: | |
inputs: | |
- lane: bitrise | |
- work_dir: "$FASTLANE_WORK_DIR" | |
- [email protected]: | |
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 | |
- [email protected]: | |
inputs: | |
- cache_paths: |- | |
$YARN_CACHE_DIR | |
node_modules | |
is_always_run: true | |
- [email protected]: {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment