diff --git a/.github/workflows/squad-ci.yml b/.github/workflows/squad-ci.yml index 0ca263b..042594b 100644 --- a/.github/workflows/squad-ci.yml +++ b/.github/workflows/squad-ci.yml @@ -3,10 +3,10 @@ name: Squad CI on: pull_request: - branches: [dev, preview, main, insider] + branches: [dev, main] types: [opened, synchronize, reopened] push: - branches: [dev, insider] + branches: [dev] permissions: contents: read @@ -25,8 +25,22 @@ jobs: with: global-json-file: global.json + - name: Discover solution file + run: | + mapfile -t matches < <(find . -maxdepth 1 -name '*.slnx') + count=${#matches[@]} + if [[ $count -eq 0 ]]; then + echo "::error::No *.slnx file found at the repository root." + exit 1 + elif [[ $count -gt 1 ]]; then + echo "::error::Multiple *.slnx files found at the repository root: ${matches[*]}" + exit 1 + fi + echo "SOLUTION_FILE=${matches[0]}" >> "$GITHUB_ENV" + echo "Discovered solution: ${matches[0]}" + - name: Restore dependencies - run: dotnet restore MyBlog.slnx + run: dotnet restore "$SOLUTION_FILE" - name: Build (Release) - run: dotnet build MyBlog.slnx --configuration Release --no-restore + run: dotnet build "$SOLUTION_FILE" --configuration Release --no-restore diff --git a/.github/workflows/squad-test.yml b/.github/workflows/squad-test.yml index 37cfd71..2c61661 100644 --- a/.github/workflows/squad-test.yml +++ b/.github/workflows/squad-test.yml @@ -71,11 +71,25 @@ jobs: restore-keys: | ${{ runner.os }}-nuget- + - name: Discover solution file + run: | + mapfile -t matches < <(find . -maxdepth 1 -name '*.slnx') + count=${#matches[@]} + if [[ $count -eq 0 ]]; then + echo "::error::No *.slnx file found at the repository root." + exit 1 + elif [[ $count -gt 1 ]]; then + echo "::error::Multiple *.slnx files found at the repository root: ${matches[*]}" + exit 1 + fi + echo "SOLUTION_FILE=${matches[0]}" >> "$GITHUB_ENV" + echo "Discovered solution: ${matches[0]}" + - name: Restore dependencies - run: dotnet restore + run: dotnet restore "$SOLUTION_FILE" - name: Build solution - run: dotnet build MyBlog.slnx --configuration Release --no-restore + run: dotnet build "$SOLUTION_FILE" --configuration Release --no-restore - name: Cache build artifacts uses: actions/cache@v5