Skip to content

Commit

Permalink
Merge pull request #85 from Aguafrommars/fix/dependencies
Browse files Browse the repository at this point in the history
ci: bump dotnet
  • Loading branch information
aguacongas authored Nov 18, 2023
2 parents cd5753c + e197c75 commit 6c211e6
Show file tree
Hide file tree
Showing 16 changed files with 108 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup .NET Core SDK
uses: actions/[email protected]
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
# Run update depencies script
- name: Update dependencies
run: ./update-dependencies.ps1
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/Aguacongas.DynamicConfiguration.AdminApi/bin/Debug/net7.0/Aguacongas.DynamicConfiguration.AdminApi.dll",
"program": "${workspaceFolder}/src/Aguacongas.DynamicConfiguration.AdminApi/bin/Debug/net8.0/Aguacongas.DynamicConfiguration.AdminApi.dll",
"args": [],
"cwd": "${workspaceFolder}/src/Aguacongas.DynamicConfiguration.AdminApi",
"stopAtEntry": false,
Expand Down
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ branches:
- /preview\/*/
- /release\/*/
image:
- Visual Studio 2019 Preview
- Visual Studio 2022
environment:
GH_TOKEN:
secure: /o9VAhx5ewGmdLR9qcgFJMzBaCuzOmGlsXAHu7khUJLdQzsv4gJzLUfYDghcRPHd
donetsdk: 7.0.100
JAVA_HOME: C:\Program Files\Java\jdk14
donetsdk: 8.0.100
JAVA_HOME: C:\Program Files\Java\jdk19
PATH: $(JAVA_HOME)\bin;$(PATH)
init:
- cmd: git config --global core.autocrlf true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
10 changes: 5 additions & 5 deletions sample/YarpSample/Yarp.AdminApi/Yarp.AdminApi.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>1760a456-20c7-402d-9941-3862601f7ab6</UserSecretsId>
Expand All @@ -10,16 +10,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="7.0.13" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.3.0" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="5.2.3" />
<PackageReference Include="Serilog.Sinks.Seq" Version="6.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
Expand All @@ -10,9 +10,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="7.0.13" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.13" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.13" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageReference Include="System.Text.Json" Version="7.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.0" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions sample/YarpSample/YarpServer/YarpServer.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Yarp.ReverseProxy" Version="2.0.1" />
<PackageReference Include="Yarp.ReverseProxy" Version="2.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="StackExchange.Redis" Version="2.7.4" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<OutputType>Library</OutputType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
<PackageReference Include="System.Text.Json" Version="7.0.3" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
Expand All @@ -14,11 +14,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="7.0.13" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.13" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.13" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="xunit" Version="2.6.1" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="bunit" Version="1.24.10" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="bunit" Version="1.25.3" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="RichardSzalay.MockHttp" Version="7.0.0" />
Expand Down
97 changes: 70 additions & 27 deletions update-dependencies.ps1
Original file line number Diff line number Diff line change
@@ -1,41 +1,83 @@
# Update one project packages
function UpdatePackages {
param (
$project
$project
)

$currentDirectoy = Get-Location

$return = $false

$dir = Split-Path $project
Write-Host 'Set-Location' $dir

Set-Location $dir

# Get outdated packages
$packageLineList = dotnet list $project package --outdated
$packageLineList = dotnet list package --outdated

foreach($line in $packageLineList) {
Write-Host $line
foreach ($line in $packageLineList) {
Write-Host $line

$match = $line -match '>\s(\S*)\s*\S*\s*\S*\s*(\S*)'
if (!$match) {
# the line doesn't contain a package information, continue
continue
}
$match = $line -match '>\s(\S*)\s*\S*\s*\S*\s*(\S*)'
if (!$match) {
# the line doesn't contain a package information, continue
continue
}

# update an outdated package
$added = dotnet add $project package $Matches.1 --version $Matches.2

if ($LASTEXITCODE -ne 0) {
# error while updating the package
Write-Error "dotnet add $project package $Matches.1 --version $Matches.2 exit with code $LASTEXITCODE"
Write-Host $added
break
}

$return = $true
Write-Host $match

$packageName = $Matches.1
$version = $Matches.2
if ($version -eq "Not") {
# latest version not found
$preReleasePackageLineList = dotnet list package --outdated --include-prerelease

foreach ($preReleaseLine in $preReleasePackageLineList) {
Write-Host $preReleaseLine
$preReleaseMatch = $preReleaseLine -match '>\s(\S*)\s*\S*\s*\S*\s*(\S*)'
if (!$preReleaseMatch) {
# the line doesn't contain a package information, continue
continue
}

if ($packageName -ne $Matches.1) {
continue
}

$latestVersion = $Matches.2
if ($latestVersion -match '-rc') {
$version = $latestVersion
Write-Host "Release candidate version found for $packageName : $version"
}
break
}
}

if ($version -eq "Not") {
continue
}

# update an outdated package
$added = dotnet add package $packageName --version $version
if ($LASTEXITCODE -ne 0) {
# error while updating the package

Write-Error "dotnet add package $packageName --version $version exit with code $LASTEXITCODE"
Write-Host $added
break
}

Write-Host 'package' $Matches.1 'version' $Matches.2 'updated'
$return = $true
}


Set-Location $currentDirectoy
return $return
}

# get branches names
$dest = "main"
$dest = "master"
if (Test-Path env:DEST_BRANCH) {
$dest = $env:DEST_BRANCH
}
Expand All @@ -53,7 +95,7 @@ dotnet restore
$projectList = dotnet sln list
$updated = $false

foreach($path in $projectList) {
foreach ($path in $projectList) {
if ($path -eq "Project(s)" -or $path -eq "----------") {
# The line doesn't contain a path, continue
continue
Expand Down Expand Up @@ -92,8 +134,9 @@ git commit -m "fix: update packages"
Write-Host "git push"

try {
git push
} catch {
git push
}
catch {

}

Expand All @@ -102,8 +145,8 @@ $authorization = "Bearer $env:GITHUB_TOKEN"
$createPrUrl = "https://api.github.com/repos/$env:GITHUB_REPOSITORY/pulls"
$headers = @{
Authorization = $authorization
Accept = "application/vnd.github.v3+json"
Accept = "application/vnd.github.v3+json"
}
$payload = "{ ""title"": ""update packages"", ""head"": ""$src"", ""base"": ""$dest"" }"
Write-Host "Invoke-WebRequest -Uri $createPrUrl -Body $payload"
Invoke-WebRequest -Uri $createPrUrl -Headers $headers -Method "POST" -Body $payload
Invoke-WebRequest -Uri $createPrUrl -Headers $headers -Method "POST" -Body $payload

0 comments on commit 6c211e6

Please sign in to comment.