Publish to Package Registries #66
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 to Package Registries | |
on: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build Package | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@main | |
with: | |
dotnet-version: '3.1' | |
- name: Build with dotnet | |
run: dotnet build --configuration Release | |
- name: Pack | |
run: dotnet pack Consoul --configuration Release --output ${{ github.workspace }}/artifacts --no-build | |
- name: Publish Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: nupkg | |
path: ${{ github.workspace }}/artifacts | |
deploy: | |
needs: build | |
name: Deploy Packages | |
runs-on: windows-latest | |
steps: | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@main | |
with: | |
dotnet-version: '3.1' | |
- name: Download Artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: nupkg | |
path: ${{ github.workspace }}/package | |
- name: Setup NuGet | |
uses: NuGet/setup-nuget@main | |
with: | |
nuget-api-key: ${{ secrets.NUGET_API_KEY }} | |
nuget-version: latest | |
- name: Push to NuGet | |
run: dotnet nuget push ${{ github.workspace }}\package\*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://nuget.org | |
- name: Add GitHub Package Registry Source | |
run: nuget sources Add -Name "GPR" -Source ${{ secrets.GPR_URI }} -UserName ${{ secrets.GPR_USERNAME }} -Password ${{ secrets.GITHUB_TOKEN }} | |
- name: Push to GitHub Packages | |
run: nuget push ${{ github.workspace }}\package\*.nupkg -Source "GPR" -SkipDuplicate |