-
Notifications
You must be signed in to change notification settings - Fork 21
80 lines (61 loc) · 2.37 KB
/
build.yml
File metadata and controls
80 lines (61 loc) · 2.37 KB
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
name: build
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: gittools/actions/gitversion/setup@v0.9.13
with:
versionSpec: '5.x'
- uses: gittools/actions/gitversion/execute@v0.9.13
id: gitversion
with:
updateAssemblyInfo: true
- uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: ${{ runner.os }}-nuget-
- run: dotnet restore
- run: dotnet run --configuration Release --no-restore --project app/NHtmlUnitGenerator/NHtmlUnit.Generator.csproj
- run: dotnet build --configuration Release --no-restore
- run: dotnet test --project tests/IntegrationTests/IntegrationTests.csproj --configuration Release --no-build --no-restore -p:CollectCoverage=true -p:CoverletOutputFormat=opencover -p:Exclude="[NHtmlUnit.Test*]*"
- uses: codecov/codecov-action@v2
- run: dotnet pack --include-source --configuration Release --no-build --no-restore -p:PackageVersion="${{ steps.gitversion.outputs.fullSemVer }}" app/NHtmlUnit/NHtmlUnit.csproj --output ${{ github.workspace }}/nugets/
- uses: actions/upload-artifact@v3
with:
name: NHtmlUnit.nupkg
path: ${{ github.workspace }}/nugets/*.nupkg
release:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/') # Only release tagged commits
steps:
- uses: actions/download-artifact@v3
with:
name: NHtmlUnit.nupkg
- name: Upload .nupkg to release
uses: meeDamian/github-release@2.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: '*.nupgk'
allow_override: true
publish:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/') # Only publish tagged commits
steps:
- uses: actions/download-artifact@v3
with:
name: NHtmlUnit.nupkg
- uses: NuGet/setup-nuget@v1.0.7
- name: Publish To NuGet.org
run: nuget push *.nupkg -Source nuget.org -ApiKey ${{ secrets.NUGET_API_KEY }}