-
Notifications
You must be signed in to change notification settings - Fork 21
78 lines (60 loc) · 1.94 KB
/
build.yml
File metadata and controls
78 lines (60 loc) · 1.94 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
name: Build
on:
push:
tags: ['*']
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: microsoft/setup-msbuild@v1
- uses: NuGet/setup-nuget@v1.1.1
- name: Restore NuGet packages
run: nuget restore NHtmlUnit.sln
- uses: gittools/actions/gitversion/setup@v0.9.14
with:
versionSpec: '5.x.x'
- uses: gittools/actions/gitversion/execute@v0.9.14
id: gitversion # step id used as reference for output values
with:
updateAssemblyInfo: true
- name: Build Solution
run: msbuild NHtmlUnit.sln /property:Configuration=Release
- name: Test Solution
run: packages\NUnit.ConsoleRunner.3.12.0\tools\nunit3-console.exe tests\IntegrationTests\bin\Release\IntegrationTests.dll
- name: Create NuGet Package
run: nuget.exe pack NHtmlUnit.nuspec -Verbosity detailed -Symbols -Properties Configuration=Release -Version ${{ steps.gitversion.outputs.nuGetVersion }}
- uses: actions/upload-artifact@v3
with:
name: NHtmlUnit.nupkg
path: '*.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.1.1
- name: Publish To NuGet.org
run: nuget push *.nupkg -Source nuget.org -ApiKey ${{ secrets.NUGET_API_KEY }}