-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ting-Yu Lin
committed
Jan 30, 2020
1 parent
5592c76
commit 02cb304
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: .NET Core Build and Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
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 Package | ||
runs-on: windows-latest # using windows agent for net462 build | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Setup .NET Core SDK | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 3.1.100 | ||
|
||
- name: Restore | ||
run: dotnet restore | ||
|
||
- name: Build | ||
run: dotnet build --configuration Release --no-restore | ||
|
||
# Run the tests, ideally should stop here if a fail and also publish results as artifacts | ||
- name: Test | ||
run: dotnet test | ||
|
||
- name: Pack | ||
run: dotnet pack --configuration Release -o finalpackage --no-build | ||
|
||
- 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: Download Package artifact | ||
uses: actions/download-artifact@master | ||
with: | ||
name: nupkg | ||
|
||
- name: Setup NuGet | ||
uses: NuGet/[email protected] | ||
with: | ||
nuget-api-key: ${{ secrets.NUGET_API_KEY }} | ||
nuget-version: latest | ||
|
||
- 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 |