@@ -5,29 +5,89 @@ on: [push, pull_request]
5
5
env :
6
6
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7
7
NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
8
+ DOCS_PATH : ${{ secrets.DOCS_PATH }}
9
+ DOCS_BRANCH : ${{ secrets.DOCS_BRANCH }}
8
10
9
11
jobs :
12
+ can_document :
13
+ runs-on : ubuntu-latest
14
+ outputs :
15
+ value : ${{ steps.check_job.outputs.value }}
16
+ steps :
17
+ - name : Checks whether documentation can be built
18
+ id : check_job
19
+ run : |
20
+ echo "value: ${{ env.DOCS_PATH != null && github.ref == env.DOCS_BRANCH }}"
21
+ echo "value=${{ env.DOCS_PATH != null && github.ref == env.DOCS_BRANCH }}" >> "${GITHUB_OUTPUT}"
22
+
23
+ documentation :
24
+ needs : [can_document]
25
+ runs-on : ubuntu-latest
26
+ if : needs.can_document.outputs.value == 'true'
27
+
28
+ steps :
29
+ - uses : actions/checkout@v4
30
+
31
+ - name : Use Node.js
32
+ uses : actions/setup-node@v4
33
+ with :
34
+ node-version : " 14.x"
35
+ registry-url : ' https://registry.npmjs.org'
36
+
37
+ - name : Install Dependencies
38
+ run : |
39
+ cd $DOCS_PATH
40
+ npm install
41
+
42
+ - name : Deploy Doclet
43
+ run : |
44
+ cd $DOCS_PATH
45
+ npx pilet publish --fresh --url https://feed.piral.cloud/api/v1/pilet/anglesharp --api-key ${{ secrets.PIRAL_FEED_KEY }}
46
+
10
47
linux :
11
48
runs-on : ubuntu-latest
12
49
13
50
steps :
14
- - uses : actions/checkout@v2
51
+ - uses : actions/checkout@v4
52
+
53
+ - name : Setup dotnet
54
+ uses : actions/setup-dotnet@v4
55
+ with :
56
+ dotnet-version : |
57
+ 6.0.x
58
+ 7.0.x
59
+ 8.0.x
15
60
16
61
- name : Build
17
- run : ./build.sh
62
+ run : dotnet build src/AngleSharp.Diffing.sln --configuration Release
63
+
64
+ - name : Test
65
+ run : dotnet test src/AngleSharp.Diffing.sln --configuration Release --no-build
18
66
19
67
windows :
20
68
runs-on : windows-latest
21
69
22
70
steps :
23
- - uses : actions/checkout@v2
71
+ - uses : actions/checkout@v4
72
+
73
+ - name : Setup dotnet
74
+ uses : actions/setup-dotnet@v4
75
+ with :
76
+ dotnet-version : |
77
+ 6.0.x
78
+ 7.0.x
79
+ 8.0.x
24
80
25
81
- name : Build
82
+ run : dotnet build src/AngleSharp.Diffing.sln --configuration Release
83
+
84
+ - name : Test
85
+ run : dotnet test src/AngleSharp.Diffing.sln --configuration Release --no-build
86
+
87
+ - name : Publish to NuGet
88
+ if : github.ref == 'refs/heads/main'
26
89
run : |
27
- if ($env:GITHUB_REF -eq "refs/heads/master") {
28
- .\build.ps1 -Target Publish
29
- } elseif ($env:GITHUB_REF -eq "refs/heads/devel") {
30
- .\build.ps1 -Target PrePublish
31
- } else {
32
- .\build.ps1
90
+ if ($env:NUGET_API_KEY) {
91
+ dotnet pack src/AngleSharp.Diffing.sln --configuration Release --no-build --output nupkgs
92
+ dotnet nuget push "nupkgs/*.nupkg" --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
33
93
}
0 commit comments