diff --git a/.gitea/workflows/ci-deploy.yml b/.gitea/workflows/ci-deploy.yml index 246a91e..ba35c84 100644 --- a/.gitea/workflows/ci-deploy.yml +++ b/.gitea/workflows/ci-deploy.yml @@ -21,12 +21,22 @@ jobs: # dir via dotnet-install.sh and retry once on failure, mirroring the # npm ci / NuGet retries elsewhere in this workflow. run: | - install() { - curl -fsSL https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh - rm -rf "$HOME/.dotnet" - bash /tmp/dotnet-install.sh --channel 9.0 --install-dir "$HOME/.dotnet" - } - install || ( echo "dotnet install failed ($?) — retrying once..." && install ) + if [ -x "$HOME/.dotnet/dotnet" ] && "$HOME/.dotnet/dotnet" --list-sdks | grep -q '^9\.'; then + echo "Reusing valid runner-local .NET 9 SDK." + else + install() { + local feed="${1:-}" + local -a feed_args=() + if [ -n "$feed" ]; then + feed_args=(--azure-feed "$feed") + fi + curl -fsSL https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh + rm -rf "$HOME/.dotnet" + bash /tmp/dotnet-install.sh --channel 9.0 --install-dir "$HOME/.dotnet" "${feed_args[@]}" + } + install || ( echo "dotnet install failed ($?) — retrying from alternate Microsoft CDN..." \ + && install https://dotnetcli.azureedge.net/dotnet ) + fi echo "$HOME/.dotnet" >> "$GITHUB_PATH" "$HOME/.dotnet/dotnet" --info