Skip to content

Commit 733c359

Browse files
committed
Use gh act if available
1 parent ca60bc8 commit 733c359

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

build-as-ci-does.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
#/usr/bin/env bash
22

3+
set -e # Fail on first failed command
4+
35
if ! command -v earthly >/dev/null; then
4-
echo "$0: No Earthly found in PATH"
6+
echo "$0: No Earthly found in PATH" >&2
57
exit 2
68
fi
79

8-
set -e # Fail on first failed command
10+
# Optionally check if gh and the act extension are installed
11+
if gh act --help >/dev/null 2>&1; then
12+
gh act --artifact-server-path $PWD/workflow-artifacts
13+
exit $?
14+
elif ! gh --help >/dev/null 2>&1; then
15+
echo "$0: No gh found in PATH; falling back to earthly" >&2
16+
else
17+
echo "$0: No nektos/gh-act extension installed; falling back to earthly" >&2
18+
fi
919

1020
# Workaround for: https://github.com/earthly/earthly/issues/4220
1121
export EARTHLY_DISABLE_REMOTE_REGISTRY_PROXY=true

0 commit comments

Comments
 (0)