Skip to content

Commit f6d5aeb

Browse files
Copilotegil
andcommitted
Modernize CI workflow to use dotnet CLI directly
Co-authored-by: egil <[email protected]>
1 parent 8deb18c commit f6d5aeb

File tree

2 files changed

+70
-9
lines changed

2 files changed

+70
-9
lines changed

.github/workflows/ci.yml

Lines changed: 69 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,89 @@ on: [push, pull_request]
55
env:
66
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
8+
DOCS_PATH: ${{ secrets.DOCS_PATH }}
9+
DOCS_BRANCH: ${{ secrets.DOCS_BRANCH }}
810

911
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+
1047
linux:
1148
runs-on: ubuntu-latest
1249

1350
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
1560
1661
- 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
1866

1967
windows:
2068
runs-on: windows-latest
2169

2270
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
2480
2581
- 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'
2689
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
3393
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ PublishScripts/
189189

190190
# NuGet Packages
191191
*.nupkg
192+
nupkgs/
192193
# The packages folder can be ignored because of Package Restore
193194
**/[Pp]ackages/*
194195
# except build/, which is used as an MSBuild target.

0 commit comments

Comments
 (0)