Skip to content

Commit 30be771

Browse files
committed
Add Build, Test, and Deploy GitHub Action
1 parent 6e37542 commit 30be771

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

.github/workflows/master.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Build, Test, and Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
paths-ignore:
9+
- 'samples/**'
10+
11+
pull_request:
12+
branches:
13+
- master
14+
- main
15+
16+
env:
17+
DOTNET_2_VERSION: '2.1.x'
18+
DOTNET_3_VERSION: '3.1.x'
19+
DOTNET_5_VERSION: '5.0.x'
20+
BUILD_CONFIGURATION: Release
21+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
22+
23+
jobs:
24+
build-and-test:
25+
runs-on: ubuntu-latest
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
dotnet: ['5.0.x']
30+
31+
steps:
32+
- uses: actions/checkout@v1
33+
34+
- name: Setup .NET Core
35+
uses: actions/setup-dotnet@v1
36+
with:
37+
dotnet-version: ${{ matrix.dotnet }}
38+
39+
- name: Build
40+
run: dotnet build --configuration ${{ env.BUILD_CONFIGURATION }}
41+
42+
- name: Unit Test
43+
run: dotnet test --configuration ${{ env.BUILD_CONFIGURATION }}
44+
45+
deploy:
46+
runs-on: ubuntu-latest
47+
needs: build-and-test
48+
strategy:
49+
fail-fast: true
50+
matrix:
51+
dotnet: ['5.0.x']
52+
53+
steps:
54+
- uses: actions/checkout@v1
55+
56+
- name: Setup .NET Core
57+
uses: actions/setup-dotnet@v1
58+
with:
59+
dotnet-version: ${{ matrix.dotnet }}
60+
61+
- uses: dotnet/nbgv@master
62+
with:
63+
setAllVars: true
64+
65+
- name: Pack
66+
run: dotnet pack --configuration ${{ env.BUILD_CONFIGURATION }}
67+
68+
- name: Push to feedz.io
69+
run: dotnet nuget push **/*.nupkg -k ${{ secrets.FEEDZ_API_KEY }} -s https://f.feedz.io/forevolve/operationresults/nuget/index.json
70+
if: github.event_name == 'pull_request'
71+
72+
- name: Push to NuGet.org
73+
run: dotnet nuget push **/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
74+
if: github.event_name == 'push'

0 commit comments

Comments
 (0)