-
Notifications
You must be signed in to change notification settings - Fork 85
109 lines (89 loc) · 2.87 KB
/
build-documentation.yml
File metadata and controls
109 lines (89 loc) · 2.87 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Build Documentation
on:
push:
branches: [main]
pull_request:
# Used to trigger the flow from Npgsql/EFCore.PG via HTTP POST
repository_dispatch:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Checkout repo
uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6.3.0
with:
node-version: 20.x
- name: Run Markdownlint
run: |
echo "::add-matcher::.github/workflows/markdownlint-problem-matcher.json"
npm i -g markdownlint-cli
markdownlint "conceptual/**/*.md"
# Setup software
- name: Setup .NET Core
uses: actions/setup-dotnet@v5.2.0
with:
dotnet-version: 10.0.x
- name: Checkout Npgsql
uses: actions/checkout@v6
with:
repository: npgsql/npgsql
ref: docs
path: Npgsql
# docfx has issues specifically with analyzer/sourcegen projects; build manually before.
- name: Build Npgsql
run: dotnet build -c Release
shell: bash
working-directory: Npgsql
- name: Checkout EFCore.PG
uses: actions/checkout@v6
with:
repository: npgsql/Npgsql.EntityFrameworkCore.PostgreSQL
ref: docs
path: EFCore.PG
- name: Build EFCore.PG
run: dotnet build -c Release
shell: bash
working-directory: EFCore.PG
- name: Get docfx
# We temporarily require a nightly biuld of docfx, supporting Roslyn 5.0.0 which Npgsql requires for its analyzer
# (https://github.com/dotnet/docfx/pull/10859#issuecomment-3794308564)
# run: dotnet tool install --version 2.78.4 -g docfx
run: |
# Get the latest nightly version from GitHub Packages
version=$(gh api /orgs/dotnet/packages/nuget/docfx/versions --jq '.[0].name')
echo "Installing docfx version: $version"
# Download the nupkg
downloadUrl="https://nuget.pkg.github.com/dotnet/download/docfx/${version}/${version}.nupkg"
curl -L -H "Authorization: Bearer $GH_TOKEN" -o "docfx.${version}.nupkg" "$downloadUrl"
# Install from local source
dotnet tool update docfx -g --prerelease --add-source .
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build docs
run: docfx --warningsAsErrors
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: _site
deploy:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref_name == 'main'
permissions:
contents: read
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