nuget_publish.yml

This commit is contained in:
2024-01-09 21:20:01 +03:00
committed by GitHub
parent 7aa94ffa90
commit 8d979ddc6f
+42
View File
@@ -0,0 +1,42 @@
name: .NET
on:
create:
branches:
- release/**
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.5
- name: Get Build Version
run: |
Import-Module .\build\GetBuildVersion.psm1
Write-Host $Env:GITHUB_REF
$version = GetBuildVersion -VersionString $Env:GITHUB_REF
echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
shell: pwsh
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore CodeCoverageExtractor/CodeCoverageExtractor.csproj
- name: Build
run: dotnet build --no-restore -p:Version=$BUILD_VERSION CodeCoverageExtractor/CodeCoverageExtractor.csproj
- name: Publish
if: startsWith(github.ref, 'refs/heads/release')
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_KEY}}