Repository navigation
80 lines (69 loc) · 2.21 KB
/
Copy pathdocs.yml
File metadata and controls
80 lines (69 loc) · 2.21 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
# Builds the documentation site with docfx for every push and pull request that changes it, and deploys it to GitHub Pages
# from main, which only moves for stable releases, so that the site describes the packages on nuget.org.
name: Docs
on:
push:
branches: ['**']
paths: &docs-paths
- 'docs/**'
- 'CHANGELOG.md'
- 'icon.png'
- 'src/CsCom.Runtime/**'
- 'src/CsCom.Runtime.Dynamic/**'
- 'src/Directory.Build.props'
- 'src/Directory.Packages.props'
- 'nuget.config'
- 'dotnet-tools.json'
- '.github/workflows/docs.yml'
pull_request:
paths: *docs-paths
workflow_dispatch:
permissions:
contents: read
# A newer push cancels the build of the same branch, but a deployment from main is never cancelled.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
defaults:
run:
shell: pwsh
jobs:
build:
# docfx loads the projects of CsCom.Runtime and CsCom.Runtime.Dynamic with the .NET SDK, on Windows like the CI build.
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-dotnet@v6
with:
dotnet-version: |
10.0.x
11.0.x
# docfx is a local tool, pinned in dotnet-tools.json.
- name: Restore docfx
run: dotnet tool restore
# A broken link or an unresolved xref is a warning of docfx, which fails the build.
- name: Build the site
run: dotnet docfx docs/docfx.json --warningsAsErrors
- name: Upload the site
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v5
with:
path: docs/_site
deploy:
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
# Only this job can deploy to GitHub Pages; the github-pages environment allows deployments from main.
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5