Skip to content

Instantly share code, notes, and snippets.

@bootstraponline
Last active November 28, 2017 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bootstraponline/b01041c05b17c3a295757651fdde52e1 to your computer and use it in GitHub Desktop.
Save bootstraponline/b01041c05b17c3a295757651fdde52e1 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -ex
if [ -z "$BITRISEIO_GIT_BRANCH_DEST" ]
then
echo "No PR detected. Skipping selective builds."
exit 0
fi
git fetch origin "$BITRISEIO_GIT_BRANCH_DEST" --depth 1
DIFF_FILES="$(git diff --name-only origin/${BITRISEIO_GIT_BRANCH_DEST})"
set +x
PATH_PATTERN=$(ruby -e 'puts ENV["TRIGGER_PATHS"].strip.split("\n").map { |e| e.gsub("/", "\\/") }.join("|") ')
echo "PATH_PATTERN: $PATH_PATTERN"
set -x
check_app_diff ()
{
set +e
echo $DIFF_FILES | grep -E $1
exit_status=$?
if [[ $exit_status = 1 ]]; then
echo "No changes detected. Aborting build."
curl -X POST \
https://api.bitrise.io/v0.1/apps/$BITRISE_APP_SLUG/builds/$BITRISE_BUILD_SLUG/abort \
-H "authorization: token $BITRISE_TOKEN" \
-H 'content-type: application/json; charset=UTF-8' \
-d '{
"abort_reason": "Build skipped. No changes detected.",
"skip_notifications": true,
"abort_with_success": true
}'
else
echo "Changes detected. Running build."
fi
set -e
}
check_app_diff "$PATH_PATTERN"
exit 0
#!/usr/bin/env bash -e
rm /etc/timezone
rm /etc/localtime
TIMEZONE="America/Denver"
export TZ="$TIMEZONE"
echo "$TIMEZONE" > /etc/timezone
cp "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
# mac
# sudo systemsetup -settimezone America/Denver
# sudo systemsetup -gettimezone
paths = [
'rn/Teacher/',
'CanvasCore/',
'Podfile.lock',
'Frameworks/SoAnnotated/',
'Frameworks/Attendance/',
'Frameworks/CanvasKeymaster/'
]
puts paths.map { |e| e.gsub("/", "\\/") }.join '|'
@bootstraponline
Copy link
Author

bootstraponline commented Nov 28, 2017

Add paths as env var in app settings. Must disable replace var in inputs, otherwise $ will be replaced.

replace_var_in_inputs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment