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 07205c8 commit c85d84f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ jobs:
steps:
- name: Clone repository
uses: actions/checkout@v4
- run: |
- shell: bash
run: |
echo "environment:\n flutter: 3.3.10" > pubspec.yaml
./setup.sh -t -p -f pubspec.yaml | grep '3.3.10'
- run: ./setup.sh -t -p | grep 'stable'
Expand Down
11 changes: 6 additions & 5 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -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 c85d84f

Please sign in to comment.