-
Notifications
You must be signed in to change notification settings - Fork 1
/
step.sh
42 lines (35 loc) · 1.64 KB
/
step.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
set -ex
echo "Installing Shorebird CLI"
# This installs shorebird into ~/.shorebird/bin and adds it to your PATH.
# It also installs a copy of Flutter and Dart inside ~/.shorebird/bin/cache/flutter.
# The copy of Flutter is slightly modified to add Shorebird code push and is not
# intended to be added to your PATH. You can continue to use the versions of
# Flutter and Dart you already have installed.
curl --proto '=https' --tlsv1.2 https://raw.githubusercontent.com/shorebirdtech/install/main/install.sh -sSf | bash
# Replace PATH to include Shorebird on Bitrise
envman add --key PATH --value '/Users/vagrant/.shorebird/bin:$PATH'
# Echo path to console
envman run bash -c 'echo "Modified path: $PATH"'
# Add to path (Helpful when running step locally)
export PATH="$(echo $HOME)/.shorebird/bin:$PATH"
# Get Flutter version from FVM or Flutter
extracted_flutter_version="-1"
which flutter
if [ $? -eq 0 ]; then
flutter_version=$(flutter --version)
extracted_flutter_version=$(echo "$flutter_version" | head -n 1 | awk '{print $2}')
echo "Flutter Version: $extracted_flutter_version"
fi
# Use parsed flutter version to sync Shorebird to installed Flutter
if [ $extracted_flutter_version != "-1" ]; then
shorebird flutter versions use $extracted_flutter_version
envman add --key SHOREBIRD_FLUTTER_VERSION --value $extracted_flutter_version
else
echo "Flutter not detected, skipping Shorebird Sync."
fi
# --- Exit codes:
# The exit code of your Step is very important. If you return
# with a 0 exit code `bitrise` will register your Step as "successful".
# Any non zero exit code will be registered as "failed" by `bitrise`.
exit 0