-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (31 loc) · 1.07 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Build
on:
push:
branches: [ main ]
tags: '**'
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal
- name: Get version
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: echo "VERSION=$(git describe --tags --dirty)" >> $GITHUB_ENV
- name: Pack
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: dotnet pack --configuration Release -o artifacts/ -p:Version=$VERSION
- name: Push
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: dotnet nuget push artifacts/**.nupkg -s nuget.org --api-key ${{secrets.NUGET_API_KEY}}