Last active
December 13, 2019 18:30
-
-
Save timheuer/962cb4ae4235e17802134a356d3b3ba0 to your computer and use it in GitHub Desktop.
build and deploy to nuget
This file contains hidden or 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: .NET Core Build and Deploy | |
on: [push] | |
jobs: | |
build: | |
#if: github.event_name == 'push' && contains(toJson(github.event.commits), '***NO_CI***') == false && contains(toJson(github.event.commits), '[ci skip]') == false && contains(toJson(github.event.commits), '[skip ci]') == false | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 3.1.100 | |
- name: Build with dotnet | |
run: dotnet build --configuration Release | |
- name: List SDKs | |
run: dotnet --list-sdks | |
# Run the tests, ideally should stop here if a fail and also publish results as artifacts | |
- name: Test with dotnet-version | |
run: dotnet test | |
- name: Pack the NuGet Package | |
run: dotnet pack --configuration Release -o finalpackage | |
# sign the NuGet Package -- can't do this without nuget.exe as dotnet CLI doesn't expose that | |
- name: Publish the artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: nupkg | |
path: finalpackage | |
deploy: | |
needs: build | |
name: Deploy to NuGet | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Package artifact | |
uses: actions/download-artifact@master | |
with: | |
name: nupkg | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 3.1.100 | |
- name: Push to NuGet | |
run: dotnet nuget push nupkg/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://nuget.org --skip-duplicate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment