Skip to content

Commit 259c2cd

Browse files
committed
feat: allow specifying nightly builds
The `version` field now accepts two additional fields: - A sha1 git hash of a `main` commit - The value `"head"` for the latest commit on `main` Signed-off-by: Justin Chadwell <me@jedevc.com>
1 parent c697168 commit 259c2cd

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

action.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,38 @@ runs:
4747
fi
4848
printf '%s/bin' "$prefix_dir" >> $GITHUB_PATH
4949
50-
# If the dagger version is 'latest', set the version back to an empty
51-
# string. This allows the install script to detect and install the latest
52-
# version itself
53-
VERSION=${{ inputs.version }}
50+
# Determine the version to install
5451
if [[ "$VERSION" == "latest" ]]; then
55-
VERSION=
52+
# Get the latest version.
53+
#
54+
# Set the version back to an empty string. This allows the install
55+
# script to detect and install the latest version itself.
56+
VERSION=""
57+
elif [[ "$VERSION" =~ ^v ]]; then
58+
# Get the specified version.
59+
#
60+
# No need to set anything.
61+
:
62+
elif [[ "$VERSION" == "head" ]]; then
63+
# Get the latest nightly build from "main".
64+
#
65+
# Set the commit to "head".
66+
COMMIT="$VERSION"
67+
VERSION=""
68+
elif [[ "$VERSION" =~ [a-z0-9]{40} ]]; then
69+
# Get the specified nightly build from "main".
70+
#
71+
# Set the commit to the specified commit sha.
72+
COMMIT="$VERSION"
73+
VERSION=""
74+
else
75+
echo "Invalid version specified: $VERSION"
76+
exit 1
5677
fi
5778
5879
# The install.sh script creates path ${prefix_dir}/bin
5980
curl -fsS https://dl.dagger.io/dagger/install.sh \
60-
| BIN_DIR=${prefix_dir}/bin DAGGER_VERSION=$VERSION sh
81+
| BIN_DIR=${prefix_dir}/bin DAGGER_VERSION=$VERSION DAGGER_COMMIT=$COMMIT sh
6182
6283
- shell: bash
6384
env:

0 commit comments

Comments
 (0)