Skip to content

chore(deps): update mcr.microsoft.com/dotnet/sdk docker tag to v9 #306

chore(deps): update mcr.microsoft.com/dotnet/sdk docker tag to v9

chore(deps): update mcr.microsoft.com/dotnet/sdk docker tag to v9 #306

Workflow file for this run

name: publish
on:
push:
branches:
- "main"
pull_request:
branches:
- "*"
concurrency:
group: ci-site-${{ github.ref }}
cancel-in-progress: false
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NuGetDirectory: ${{ github.workspace}}/nuget
defaults:
run:
shell: pwsh
jobs:
lint_config:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- run: dotnet run --project=tools/ConfigFilesGenerator/ConfigFilesGenerator.csproj
create_nuget:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- run: |
try
{
$(Invoke-WebRequest "https://www.nuget.org/api/v2/package/Meziantou.DotNet.CodingStandard/").BaseResponse.RequestMessage.RequestUri -match "meziantou\.dotnet\.codingstandard\.1\.0\.([0-9]+).nupkg"
$NewVersion = "1.0.$([int]$Matches.1 + 1)"
}
catch
{
$NewVersion = "1.0.0"
}
Write-Host "New version: $NewVersion"
"package_version=$NewVersion" >> $env:GITHUB_OUTPUT
name: Compute version
id: compute-version
- run: nuget pack Meziantou.DotNet.CodingStandard.nuspec -ForceEnglishOutput -Version ${{ steps.compute-version.outputs.package_version }} -Properties "RepositoryCommit=${{ github.sha }};RepositoryBranch=${{ github.ref_name }};RepositoryUrl=${{ github.repositoryUrl }}"
- uses: actions/upload-artifact@v4
with:
name: nuget
if-no-files-found: error
retention-days: 3
path: "**/*.nupkg"
test:
runs-on: ubuntu-latest
needs: [create_nuget]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: nuget
path: ${{ env.NuGetDirectory }}
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
8.0.x
- run: dotnet --info
- run: dotnet test tests/Meziantou.DotNet.CodingStandard.Tests/Meziantou.DotNet.CodingStandard.Tests.csproj --logger "trx;LogFileName=test_results.trx" --results-directory test_results
- uses: actions/upload-artifact@v4
if: always()
with:
name: test_results
path: test_results
deploy:
runs-on: "ubuntu-latest"
needs: [create_nuget, lint_config, test]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: nuget
path: ${{ env.NuGetDirectory }}
- uses: actions/setup-dotnet@v4
- run: |
Write-Host "Current ref: $env:GITHUB_REF"
Write-Host "Searching nupkg in folder: ${{ env.NuGetDirectory }}"
$files = Get-ChildItem "${{ env.NuGetDirectory }}/*" -Recurse -Include *.nupkg
foreach($file in $files) {
Write-Host "Pushing NuGet package: $($file.FullName)"
if ($env:GITHUB_REF -eq 'refs/heads/main')
{
& dotnet nuget push "$($file.FullName)" --api-key "$env:NuGetApiKey" --source https://api.nuget.org/v3/index.json --force-english-output --skip-duplicate
}
else
{
& dotnet nuget push "$($file.FullName)" --api-key "$env:FeedzApiKey" --source https://f.feedz.io/meziantou/meziantou-dotnet-codingstandard/nuget/index.json --force-english-output --skip-duplicate
}
}
name: Publish NuGet packages
if: always()
env:
NuGetApiKey: ${{ secrets.NuGetApiKey }}
FeedzApiKey: ${{ secrets.FEEDZ_APIKEY }}