From 0afb9b93b991e8c5f40123f0012c282bdf0e5eb5 Mon Sep 17 00:00:00 2001 From: Trais McAllister Date: Wed, 15 Feb 2023 16:34:32 -0800 Subject: [PATCH 1/2] Create main.yml --- .github/workflows/main.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..15fa18ce --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,35 @@ +name: Publish NuGet Package + +on: + release: + types: [published] + workflow_dispatch: + +env: + NUGET_REGISTRY: https://nuget.pkg.github.com/ + NUGET_NAMESPACE: mtconnect + NUGET_API_KEY: ${{ secrets.GITHUB_TOKEN }} + VS_PROJECT: MtconnectTranspiler.Sinks.CSharp + +jobs: + build: + name: Build + Publish to GitHub Packages + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '5.0.x' + - name: Build with dotnet + run: dotnet build "${{ env.VS_PROJECT }}\${{ env.VS_PROJECT }}.csproj" --configuration Release + - name: Pack NuGet package + run: dotnet pack "${{ env.VS_PROJECT }}\${{ env.VS_PROJECT }}.csproj" -c Release -o artifacts --no-build + - name: Publish Artifact + uses: actions/upload-artifact@master + with: + name: nupkg + path: artifacts + - name: Publish NuGet package to GitHub Packages + run: dotnet nuget push artifacts\*.nupkg --source ${{ env.NUGET_REGISTRY }}${{ env.NUGET_NAMESPACE }} --api-key ${{ env.NUGET_API_KEY }} From 969cbc11e53f6802d2f6aaa32ff024d5bb8b6c6c Mon Sep 17 00:00:00 2001 From: Trais McAllister Date: Wed, 15 Feb 2023 16:39:25 -0800 Subject: [PATCH 2/2] Update main.yml --- .github/workflows/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 15fa18ce..dfb3cdc6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,6 +18,9 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 + - name: Add NuGet source + run: | + nuget sources add -name "GitHub Packages (MTConnect)" -source "https://nuget.pkg.github.com/mtconnect/index.json" -username ${{ github.actor }} -password ${{ secrets.GITHUB_TOKEN }} - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: