Publish a NuGet Package #72
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish a NuGet Package | |
on: | |
release: | |
types: [ published ] | |
env: | |
BRANCH: master | |
defaults: | |
run: | |
working-directory: src | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 6.0.x | |
- name: Setup NuGet.exe | |
uses: nuget/setup-nuget@v1 | |
with: | |
nuget-api-key: ${{ secrets.nuget_api_key }} | |
nuget-version: 'latest' | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build solution | |
run: dotnet build --configuration Release --no-restore | |
- name: Run tests | |
run: dotnet test --no-restore | |
- shell: pwsh | |
name: Create SNK File | |
env: | |
SNK: ${{ secrets.snk }} | |
run: | | |
$snk = [Convert]::FromBase64String("$env:SNK") | |
Set-Content "Solution Items\GiGraph.snk" -Value $snk -AsByteStream | |
- name: Build NuGet Package | |
run: | | |
nuget pack "GiGraph.Dot\GiGraph.Dot.csproj" -Build -Symbols -Properties "Configuration=Publish;repository=${{ github.repository }};branch=${{ env.BRANCH }};commit=${{ github.sha }}" -IncludeReferencedProjects -SymbolPackageFormat snupkg -OutputFileNamesWithoutVersion | |
- name: Publish NuGet Package | |
run: | | |
nuget push GiGraph.Dot.nupkg -Source https://api.nuget.org/v3/index.json |