22
33on :
44 schedule :
5- # Runs daily at 02:00 UTC (adjust as you like)
65 - cron : " 0 2 * * *"
76 workflow_dispatch :
87
2120 - name : Checkout
2221 uses : actions/checkout@v4
2322 with :
24- # Needed so we can push back using GITHUB_TOKEN
2523 persist-credentials : true
2624 fetch-depth : 0
2725
@@ -30,17 +28,14 @@ jobs:
3028 with :
3129 dotnet-version : " 10.0.x"
3230
33- - name : Show .NET info
34- run : dotnet --info
35-
3631 - name : Locate solution
3732 id : sln
3833 shell : bash
3934 run : |
4035 set -euo pipefail
4136 SLN="$(ls -1 *.sln 2>/dev/null | head -n 1 || true)"
4237 if [[ -z "${SLN}" ]]; then
43- SLN="$(find . -maxdepth 4 -name '*.sln' -print | head -n 1 || true)"
38+ SLN="$(find . -maxdepth 5 -name '*.sln' -print | head -n 1 || true)"
4439 fi
4540 if [[ -z "${SLN}" ]]; then
4641 echo "No .sln file found."
@@ -52,10 +47,31 @@ jobs:
5247 - name : Restore
5348 run : dotnet restore "${{ steps.sln.outputs.sln }}"
5449
55- - name : Update NuGet package references
56- # .NET 10+ command that updates PackageReference versions
57- # When no package names are provided, it attempts to update all packages in the project/solution.
58- run : dotnet package update --project "${{ steps.sln.outputs.sln }}"
50+ - name : Update NuGet packages (per project)
51+ shell : bash
52+ run : |
53+ set -euo pipefail
54+
55+ # Find csproj files (exclude obj/bin to avoid weirdness)
56+ mapfile -t PROJECTS < <(find . -name '*.csproj' \
57+ -not -path '*/bin/*' \
58+ -not -path '*/obj/*' \
59+ -print | sort)
60+
61+ if [[ ${#PROJECTS[@]} -eq 0 ]]; then
62+ echo "No .csproj files found."
63+ exit 1
64+ fi
65+
66+ echo "Updating ${#PROJECTS[@]} projects:"
67+ printf ' - %s\n' "${PROJECTS[@]}"
68+
69+ # Update each project individually (workaround for solution-level unsupported update)
70+ for p in "${PROJECTS[@]}"; do
71+ echo ""
72+ echo "=== Updating: $p ==="
73+ dotnet package update --project "$p"
74+ done
5975
6076 - name : Build
6177 run : dotnet build "${{ steps.sln.outputs.sln }}" -c Release --no-restore
0 commit comments