-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (74 loc) · 2.6 KB
/
dotnet-core.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: CI/CD
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.next_tag }}
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.101
- id: version
name: Calculate Version
uses: craig-day/compute-tag@v10
with:
github_token: ${{ github.token }}
version_scheme: semantic
version_type: patch
- name: Install dependencies (Solution)
run: dotnet restore Solution/NAoCHelper.csproj
- name: Build
run: dotnet build --configuration Release --no-restore /p:Version=${{ steps.version.outputs.next_tag }} Solution/NAoCHelper.csproj
- name: Install dependencies (Tests)
run: dotnet restore Tests/NAoCHelperTests.csproj
- name: Test
run: dotnet test --no-restore --verbosity normal Tests/NAoCHelperTests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info
- name: Coverage
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./Tests/lcov.info
- name: Upload Build Artifact
uses: actions/upload-artifact@v2
with:
name: NuGetPackage
path: ./Solution/bin/Release/NAoCHelper.${{steps.version.outputs.next_tag }}.nupkg
release:
runs-on: ubuntu-latest
if: ${{ contains(github.ref, 'master')}}
needs: [build]
steps:
- name: Download Build Artifact
uses: actions/download-artifact@v2
with:
name: NuGetPackage
- name: Push to NuGet
run: dotnet nuget push ./NAoCHelper.${{ needs.build.outputs.version }}.nupkg -k $NuGetApiKey -s https://api.nuget.org/v3/index.json
env:
NuGetApiKey: ${{ secrets.NuGetApiKey }}
- name: Release
id: release
uses: actions/create-release@v1
with:
tag_name: ${{ needs.build.outputs.version }}
release_name: ${{ needs.build.outputs.version }}
body: >
Automatic release of ${{ needs.build.outputs.version }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ./NAoCHelper.${{ needs.build.outputs.version }}.nupkg
asset_name: NAoCHelper.${{ needs.build.outputs.version }}.nupkg
asset_content_type: application/zip