Publish to Package Registries #73
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: | |
env: | |
GH_NUGET_REGISTRY: https://nuget.pkg.github.com/ | |
GH_NUGET_NAMESPACE: trueanalyticssolutions | |
GH_NUGET_API_KEY: ${{ secrets.GITHUB_TOKEN }} | |
VS_PROJECT: TcpAdapter | |
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 Mtconnect.TcpAdapter with dotnet | |
run: dotnet build "Mtconnect.TcpAdapter\TcpAdapter.csproj" --configuration Release | |
- name: Pack Mtconnect.TcpAdapter | |
run: dotnet pack "Mtconnect.TcpAdapter\TcpAdapter.csproj" --configuration Release -o finalpackage --no-build --include-symbols | |
- name: Publish Artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: nupkg | |
path: finalpackage | |
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@v1 | |
with: | |
name: nupkg | |
- name: Setup NuGet | |
uses: NuGet/setup-nuget@main | |
with: | |
nuget-api-key: ${{ secrets.NUGETORG_API_KEY }} | |
nuget-version: latest | |
- name: Push Mtconnect.TcpAdapter to NuGet | |
run: dotnet nuget push nupkg\*.nupkg -k ${{ secrets.NUGETORG_API_KEY }} -s https://nuget.org --skip-duplicate | |
- name: Push NuGet package to GitHub Packages | |
run: dotnet nuget push nupkg\*.nupkg --source ${{ env.GH_NUGET_REGISTRY }}${{ env.GH_NUGET_NAMESPACE }} --api-key ${{ env.GH_NUGET_API_KEY }} |