Skip to content

Commit

Permalink
Add GitHub workflow
Browse files Browse the repository at this point in the history
  • 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.
62 changes: 62 additions & 0 deletions .github/workflows/build.yml
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/setup-nuget@v1.0.2
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

0 comments on commit 02cb304

Please sign in to comment.