Skip to content

Commit

Permalink
enable shell options: errexit and nounset
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Apr 1, 2024
1 parent ad0b5ca commit cde9da9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions setup.sh
@@ -1,4 +1,5 @@
#!/bin/bash
set -eu

check_command() {
command -v "$1" >/dev/null 2>&1
Expand Down Expand Up @@ -111,7 +112,7 @@ if [ -n "$VERSION_FILE" ]; then
fi

ARR_CHANNEL=("${@:$OPTIND:1}")
CHANNEL="${ARR_CHANNEL[0]}"
CHANNEL="${ARR_CHANNEL[0]:-}"

[ -z "$CHANNEL" ] && CHANNEL=stable
[ -z "$VERSION" ] && VERSION=any
Expand All @@ -127,7 +128,7 @@ CHANNEL="${ARR_CHANNEL[0]}"
# If `PUB_CACHE` is set already, then it should continue to be used. Otherwise, satisfy it
# if the action requests a custom path, or set to the Dart default values depending
# on the operating system.
if [ -z "$PUB_CACHE" ]; then
if [ -z "${PUB_CACHE:-}" ]; then
if [ "$PUB_CACHE_PATH" != "default" ]; then
PUB_CACHE="$PUB_CACHE_PATH"
elif [ "$OS_NAME" = "windows" ]; then
Expand Down Expand Up @@ -203,7 +204,7 @@ if [ "$PRINT_ONLY" = true ]; then
echo "CACHE-PATH=$CACHE_PATH"
echo "PUB-CACHE-KEY=$PUB_CACHE_KEY"
echo "PUB-CACHE-PATH=$PUB_CACHE"
} >>"$GITHUB_OUTPUT"
} >>"${GITHUB_OUTPUT:-/dev/null}"

exit 0
fi
Expand All @@ -224,10 +225,10 @@ fi
{
echo "FLUTTER_ROOT=$CACHE_PATH"
echo "PUB_CACHE=$PUB_CACHE"
} >>"$GITHUB_ENV"
} >>"${GITHUB_ENV:-/dev/null}"

{
echo "$CACHE_PATH/bin"
echo "$CACHE_PATH/bin/cache/dart-sdk/bin"
echo "$PUB_CACHE/bin"
} >>"$GITHUB_PATH"
} >>"${GITHUB_PATH:-/dev/null}"

0 comments on commit cde9da9

Please sign in to comment.