Skip to content

Commit

Permalink
Create reliase-to-nuget.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Shvedun committed Aug 15, 2024
1 parent d7bfd98 commit ba4f6f1
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/reliase-to-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: release-to-nuget

on:
release:
types: [published]

jobs:
build:
name: release-to-nuget
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1 # Shallow clones should be disabled for a better relevancy of analysis

- name: Test Solution
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
$ErrorActionPreference = 'Stop'
dotnet test .\clio.tests\clio.tests.csproj -nowarn:none `
/p:CollectCoverage=true /p:CoverletOutputFormat=opencover `
/p:CoverletOutput=".\..\TestResults\coverage.opencover.xml";
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_URL: ${{ secrets.SONAR_URL }}
shell: powershell
run: |
dotnet sonarscanner begin /k:"clio" /d:sonar.host.url="${{ secrets.SONAR_URL }}" `
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" `
/d:sonar.cs.opencover.reportsPaths="TestResults\coverage.opencover.xml";
dotnet build .\clio\clio.csproj -c Release --no-incremental;
dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
dotnet build-server shutdown;
- name: Pack
run: dotnet pack .\clio\clio.csproj --configuration Release --output ./output

- name: Publish to NuGet
env:
NUGET_API_KEY: ${{ secrets.CLIO_NUGET_API_KEY }}
run: dotnet nuget push "./output/*.nupkg" --api-key ${{ secrets.CLIO_NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

0 comments on commit ba4f6f1

Please sign in to comment.