Skip to content

Commit

Permalink
use dotnet outdated
Browse files Browse the repository at this point in the history
  • Loading branch information
goswinr committed Feb 15, 2025
1 parent 17f2cad commit 8e864b1
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 14 deletions.
23 changes: 11 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ updates:
schedule:
interval: "weekly"

# Update to newer NuGet dependencies
- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "daily"
ignore:
# keep at Rhino 7
- dependency-name: "RhinoCommon"
# don't do nuget here, WPF does not build correctly on linux
# to work on FSharp.Core too the fsproj needs : <DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
# and <PackageReference Include="FSharp.Core" Version= ...
# see https://github.com/dependabot/dependabot-core/issues/10883
# - package-ecosystem: "nuget"
# directory: "/"
# schedule:
# interval: "daily"
# ignore:
# # keep at Rhino 7
# - dependency-name: "RhinoCommon"


# - package-ecosystem: "nuget"
# directory: "/Tests/"
# schedule:
# interval: "daily"
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
dotnet-version: '9.x'

- name: Build
run: dotnet build --configuration Release
Expand Down
112 changes: 112 additions & 0 deletions .github/workflows/outdatedNuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Check NuGet # this name shows in Readme badge
# In the Github UI this workflow need: Settings -> Actions -> General -> Workflow Permissions:
# 'Read and write permissions' and
# 'Allow Github Actions to create and approve pull requests'

# for FSharp.Core to be updated use
# <DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
# and the 'Include' instead of the 'Update' syntax:
# <PackageReference Include="FSharp.Core" Version="..." />

on:
# Allows you to run this workflow manually from the Actions tab in Github.com
workflow_dispatch:

schedule:
- cron: '0 0 * * *' # Runs daily at midnight UTC
# - cron: '0 * * * *' # Runs every hour for testing
# - cron: '*/6 * * * *' # Runs every 6 minutes for testing

# push: cannot trigger a pull request , see https://github.com/peter-evans/create-pull-request/tree/v7/?tab=readme-ov-file#token

permissions: # https://github.com/peter-evans/create-pull-request/tree/v7/?tab=readme-ov-file#token
contents: write
pull-requests: write

jobs:
nuget-update:
runs-on: windows-latest # so that WPF build works too

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x' # Specify the .NET version you are using

- name: Restore NuGet packages
run: dotnet restore

- name: Install dotnet-outdated
run: dotnet tool install -g dotnet-outdated-tool

- name: Simulate Update NuGet packages to get JSON output
run: dotnet outdated --output outdated.json --exclude RhinoCommon

- name: Parse JSON and concatenate unique versions
shell: pwsh
run: |
if (Test-Path 'outdated.json') {
$json = Get-Content 'outdated.json' | ConvertFrom-Json
$uniqueDeps = @{}
foreach ($project in $json.Projects) {
foreach ($framework in $project.TargetFrameworks) {
foreach ($dep in $framework.Dependencies) {
if (-not $uniqueDeps.ContainsKey($dep.Name)) {
$uniqueDeps[$dep.Name] = "$($dep.Name) to $($dep.LatestVersion) (from $($dep.ResolvedVersion))"
}
}
}
}
$result = $uniqueDeps.Values
$concatenated = "Bump " + ($result -join '; ')
echo "COMMIT_MSG=$concatenated" >> $env:GITHUB_ENV
Remove-Item -Path outdated.json -Force
}
else {
echo 'No outdated.json file found'
echo "COMMIT_MSG=" >> $env:GITHUB_ENV
}
- name: Update NuGet packages and get Markdown output
# if no updates are available, no output.json file is created
if: ${{env.COMMIT_MSG }}
run: dotnet outdated --upgrade --output outdated.md --output-format Markdown --exclude RhinoCommon


- name: Read outdated.md file
if: ${{env.COMMIT_MSG }}
id: read-md
uses: juliangruber/read-file-action@v1
with:
path: ./outdated.md

- name: Delete outdated.md file
if: ${{env.COMMIT_MSG }}
shell: pwsh
run: Remove-Item -Path outdated.md -Force

# This will not create a duplicate PR if one exists already
- name: Create Pull Request
if: ${{env.COMMIT_MSG }}
uses: peter-evans/create-pull-request@v7
with:
commit-message: ${{ env.COMMIT_MSG }}
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
branch: dotnet-outdated-bot
delete-branch: true
title: ${{ env.COMMIT_MSG }}
body: ${{ steps.read-md.outputs.content }}
labels: "dotnet-outdated"









2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
dotnet-version: '9.x'

- name: Build
run: dotnet build --configuration Release
Expand Down
1 change: 1 addition & 0 deletions Fesh.Rhino.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
targeting net 7 actually fails to find the System.Drawing.Bitmap reference during build even if System.Drawing.Common is included.
using net48 target on net7 will not allow async evaluation.
-->

<LangVersion>preview</LangVersion> <!-- enables indexing from end -->
<NeutralLanguage>en</NeutralLanguage>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages> <!--to only have the english resources-->
Expand Down

0 comments on commit 8e864b1

Please sign in to comment.