Skip to content

Update dependency Meziantou.Analyzer to v2.0.135 #240

Update dependency Meziantou.Analyzer to v2.0.135

Update dependency Meziantou.Analyzer to v2.0.135 #240

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
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
- run: dotnet run --project=tools/ConfigFilesGenerator/ConfigFilesGenerator.csproj
create_nuget:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
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"
deploy:
runs-on: "ubuntu-22.04"
needs: [create_nuget, lint_config]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: nuget
path: ${{ env.NuGetDirectory }}
- name: Setup .NET Core
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
{
Write-Host "Not on the default branch => Do not push"
}
}
name: Publish NuGet packages
if: always()
env:
NuGetApiKey: ${{ secrets.NuGetApiKey }}