@@ -45,12 +45,42 @@ jobs:
4545 git checkout -b "$BRANCH_NAME"
4646
4747 # List outdated packages
48- dotnet list QRCoder.Core.sln package --outdated
48+ dotnet list QRCoder.Core.sln package --outdated --format json > outdated-packages.json
4949
50- # Update packages (this is a simplified approach)
50+ # Update packages using the latest available versions
5151 echo "📦 Updating NuGet packages..."
52- dotnet add src/Metar.Decoder package --version latest || echo "No updates needed for Metar.Decoder"
53- dotnet add src/Taf.Decoder package --version latest || echo "No updates needed for Taf.Decoder"
52+ python3 - <<'PY'
53+ import json
54+ import pathlib
55+ import subprocess
56+
57+ data = json.loads(pathlib.Path("outdated-packages.json").read_text())
58+ updates = {}
59+
60+ for project in data.get("projects", []):
61+ project_path = pathlib.Path(project["path"]).resolve()
62+ for framework in project.get("frameworks", []):
63+ for package in framework.get("topLevelPackages", []):
64+ latest = package.get("latestVersion")
65+ requested = package.get("requestedVersion")
66+ if latest and latest != requested:
67+ updates.setdefault(project_path, {})[package["id"]] = latest
68+
69+ for project_path, packages in updates.items():
70+ for package_name, latest_version in sorted(packages.items()):
71+ subprocess.run(
72+ [
73+ "dotnet",
74+ "add",
75+ str(project_path),
76+ "package",
77+ package_name,
78+ "--version",
79+ latest_version,
80+ ],
81+ check=True,
82+ )
83+ PY
5484
5585 # Check if there are any changes
5686 if git diff --quiet; then
0 commit comments