Skip to content

Commit bd0c56c

Browse files
committed
Update script/setup for GitHub Actions
Signed-off-by: Mattt Zmuda <[email protected]>
1 parent 164f905 commit bd0c56c

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

script/setup

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,35 @@
11
#!/bin/sh
22

3-
set -e
3+
set -eu
44

5-
if ! command -v rye > /dev/null 2>&1
6-
then
5+
: "${GITHUB_ACTIONS:=}"
6+
: "${RYE_INSTALL_OPTION:='--yes'}"
7+
: "${RYE_VERSION:='latest'}"
8+
9+
install_rye() {
10+
curl -sSf https://rye-up.com/get | sh
11+
}
12+
13+
if [ -n "$GITHUB_ACTIONS" ]; then
14+
install_rye
15+
echo "$HOME/.rye/shims" >>"$GITHUB_PATH"
16+
elif ! command -v rye >/dev/null 2>&1; then
717
echo "rye is not installed."
818
printf "Do you want to install rye? (y/n) "
919
read -r REPLY
10-
echo # move to a new line
11-
case "$REPLY" in
12-
[yY])
13-
echo "Installing rye..."
14-
curl -sSf https://rye-up.com/get | sh
15-
echo "rye has been successfully installed."
16-
;;
17-
*)
18-
exit 1
19-
;;
20+
echo
21+
case "$REPLY" in
22+
[yY])
23+
echo "Installing rye..."
24+
install_rye
25+
echo "rye has been successfully installed."
26+
;;
27+
*)
28+
exit 1
29+
;;
2030
esac
2131
else
22-
echo "Rye is already installed."
32+
echo "rye is already installed."
2333
fi
2434

2535
exec rye sync

0 commit comments

Comments
 (0)