Skip to content

Commit 5dca336

Browse files
committed
setup-spin: Avoid requiring git
`spin plugins install` requires `git` to be availble (because it clones `https://github.com/spinframework/spin-plugins` to look at the manifests); avoid that by probing for the expected plugin manifest and using that directly. Signed-off-by: Mark Yen <[email protected]>
1 parent 3575829 commit 5dca336

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

resources/setup-spin

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,15 @@ install_plugin() {
4848
version=$2
4949
echo "Installing plugin ${plugin} version ${version}"
5050
"$spin" plugins uninstall "$plugin" || true
51-
"$spin" plugins install --yes --version "${version}" "$plugin"
51+
# `spin plugins install` requires `git`; however, we can provide the URL of a
52+
# remote manifest instead.
53+
local url_base="https://github.com/spinframework/spin-plugins/raw/refs/heads/main/manifests/${plugin}"
54+
local url="${url_base}/${plugin}@${version}.json"
55+
if ! curl --head --silent --fail "${url}" &>/dev/null; then
56+
echo "Plugin not available at ${url}, installing unversioned instead."
57+
url="${url_base}/${plugin}.json"
58+
fi
59+
"$spin" plugins install --yes --url "${url}"
5260
rc=$?; test $rc -ne 0 && echo "Exit status is $rc"
5361
}
5462

0 commit comments

Comments
 (0)