From 61befc16d89b4ed8cf23bf6a691e6a8b9a6dcdd1 Mon Sep 17 00:00:00 2001 From: cesnimda Date: Thu, 27 Aug 2026 17:46:01 +0200 Subject: [PATCH] fix(ci): validate private .NET SDK --- .gitea/workflows/ci-deploy.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/ci-deploy.yml b/.gitea/workflows/ci-deploy.yml index ba35c84..d90b5e1 100644 --- a/.gitea/workflows/ci-deploy.yml +++ b/.gitea/workflows/ci-deploy.yml @@ -21,7 +21,16 @@ jobs: # dir via dotnet-install.sh and retry once on failure, mirroring the # npm ci / NuGet retries elsewhere in this workflow. run: | - if [ -x "$HOME/.dotnet/dotnet" ] && "$HOME/.dotnet/dotnet" --list-sdks | grep -q '^9\.'; then + export DOTNET_ROOT="$HOME/.dotnet" + export PATH="$DOTNET_ROOT:$PATH" + + validate_sdk() { + [ -x "$DOTNET_ROOT/dotnet" ] \ + && "$DOTNET_ROOT/dotnet" --list-sdks | grep -q '^9\.' \ + && "$DOTNET_ROOT/dotnet" --info >/dev/null + } + + if validate_sdk; then echo "Reusing valid runner-local .NET 9 SDK." else install() { @@ -31,14 +40,15 @@ jobs: 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[@]}" + rm -rf "$DOTNET_ROOT" + bash /tmp/dotnet-install.sh --channel 9.0 --install-dir "$DOTNET_ROOT" "${feed_args[@]}" + validate_sdk } 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 + echo "$DOTNET_ROOT" >> "$GITHUB_PATH" + "$DOTNET_ROOT/dotnet" --info - name: Setup Node uses: actions/setup-node@v4