Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@
"version": "0.0.1-preview.537",
"commands": [
"dotnet-validate"
]
],
"rollForward": false
},
"meziantou.framework.nugetpackagevalidation.tool": {
"version": "1.0.31",
"commands": [
"meziantou.validate-nuget-package"
],
"rollForward": false
}
}
}
32 changes: 26 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:

outputs:
dotnet-sdk-version: ${{ steps.setup-dotnet.outputs.dotnet-version }}
dotnet-validate-version: ${{ steps.get-dotnet-validate-version.outputs.dotnet-validate-version }}
dotnet-validate-version: ${{ steps.get-dotnet-tools-versions.outputs.dotnet-validate-version }}
nuget-package-validation-version: ${{ steps.get-dotnet-tools-versions.outputs.nuget-package-validation-version }}
package-names: ${{ steps.build.outputs.package-names }}
package-version: ${{ steps.build.outputs.package-version }}

Expand Down Expand Up @@ -113,12 +114,15 @@ jobs:
path: ./artifacts/package/release
if-no-files-found: error

- name: Get dotnet-validate version
id: get-dotnet-validate-version
- name: Get .NET tools versions
id: get-dotnet-tools-versions
shell: pwsh
run: |
$dotnetValidateVersion = (Get-Content "./.config/dotnet-tools.json" | Out-String | ConvertFrom-Json).tools.'dotnet-validate'.version
"dotnet-validate-version=${dotnetValidateVersion}" >> $env:GITHUB_OUTPUT
$manifest = (Get-Content "./.config/dotnet-tools.json" | Out-String | ConvertFrom-Json)
$dotnetValidateVersion = $manifest.tools.'dotnet-validate'.version
$nugetPackageValidationVersion = $manifest.tools.'meziantou.framework.nugetpackagevalidation.tool'.version
"dotnet-validate-version=${dotnetValidateVersion}" >> ${env:GITHUB_OUTPUT}
"nuget-package-validation-version=${nugetPackageValidationVersion}" >> ${env:GITHUB_OUTPUT}

validate-packages:
needs: build
Expand All @@ -135,17 +139,33 @@ jobs:
with:
dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }}

- name: Validate NuGet packages
- name: Install NuGet package validation tools
shell: pwsh
env:
DOTNET_VALIDATE_VERSION: ${{ needs.build.outputs.dotnet-validate-version }}
NUGET_PACKAGE_VALIDATION_VERSION: ${{ needs.build.outputs.nuget-package-validation-version }}
run: |
dotnet tool install --global dotnet-validate --version ${env:DOTNET_VALIDATE_VERSION} --allow-roll-forward
dotnet tool install --global Meziantou.Framework.NuGetPackageValidation.Tool --version ${env:NUGET_PACKAGE_VALIDATION_VERSION} --allow-roll-forward

- name: Validate NuGet packages
shell: pwsh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$packages = Get-ChildItem -Filter "*.nupkg" | ForEach-Object { $_.FullName }
$invalidPackages = 0
foreach ($package in $packages) {
$isValid = $true
dotnet validate package local $package
if ($LASTEXITCODE -ne 0) {
$isValid = $false
}
meziantou.validate-nuget-package $package --github-token ${env:GH_TOKEN}
if ($LASTEXITCODE -ne 0) {
$isValid = $false
}
if (-Not $isValid) {
$invalidPackages++
}
}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:

"" >> $properties

"version=${updatedVersion}" >> $env:GITHUB_OUTPUT
"version=${updatedVersion}" >> ${env:GITHUB_OUTPUT}

- name: Push changes to GitHub
id: push-changes
Expand Down Expand Up @@ -110,9 +110,9 @@ jobs:
git commit -m "Bump version`n`nBump version to ${env:NEXT_VERSION} for the next release." -s
git push -u origin $branchName

"branch-name=${branchName}" >> $env:GITHUB_OUTPUT
"updated-version=true" >> $env:GITHUB_OUTPUT
"version=${env:NEXT_VERSION}" >> $env:GITHUB_OUTPUT
"branch-name=${branchName}" >> ${env:GITHUB_OUTPUT}
"updated-version=true" >> ${env:GITHUB_OUTPUT}
"version=${env:NEXT_VERSION}" >> ${env:GITHUB_OUTPUT}

- name: Create pull request
if: steps.push-changes.outputs.updated-version == 'true'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
$properties = Join-Path "." "Directory.Build.props"
$xml = [xml](Get-Content $properties)
$version = $xml.SelectSingleNode('Project/PropertyGroup/VersionPrefix').InnerText
"version=${version}" >> $env:GITHUB_OUTPUT
"version=${version}" >> ${env:GITHUB_OUTPUT}

- name: Create release
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
Expand Down
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function DotNetTest {

$additionalArgs = @()

if (-Not [string]::IsNullOrEmpty($env:GITHUB_SHA)) {
if (-Not [string]::IsNullOrEmpty(${env:GITHUB_SHA})) {
$additionalArgs += "--logger:GitHubActions;report-warnings=false"
$additionalArgs += "--logger:junit;LogFilePath=junit.xml"
}
Expand Down
Loading