Skip to content

Commit

Permalink
Support publishing documentation via github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
badcel committed Feb 24, 2024
1 parent 2eda010 commit 14a8587
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy documentation

on:
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4

- name: Move readme into website
run: cp ./readme.md ./docs
- name: Rename readme
run: mv ./docs/readme.md ./docs/index.md

- name: Prepare .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Install docfx
run: dotnet tool update -g docfx
- name: Build website
run: docfx docs/docfx.json
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './_site'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ coverage.*

# Visual Studio
.vs/
*.DotSettings.user
*.DotSettings.user

#Docs
_site/
45 changes: 45 additions & 0 deletions docs/docfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"metadata": [
{
"src": [
{
"src": "../src/HidApi.Net",
"files": [
"**/*.csproj"
]
}
],
"dest": "api"
}
],
"build": {
"content": [
{
"files": [
"**/*.{md,yml}"
],
"exclude": [
"_site/**"
]
}
],
"resource": [
{
"files": [
"images/**"
]
}
],
"output": "../_site",
"template": [
"default",
"modern"
],
"globalMetadata": {
"_appName": "HidApi.Net",
"_appTitle": "HidApi.Net",
"_enableSearch": true,
"pdf": false
}
}
}
2 changes: 2 additions & 0 deletions docs/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: Api Documentation
href: api/
10 changes: 10 additions & 0 deletions src/HidApi.Net.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt
..\.github\dependabot.yml = ..\.github\dependabot.yml
Directory.Build.props = Directory.Build.props
..\readme.md = ..\readme.md
..\.github\workflows\documentation.yml = ..\.github\workflows\documentation.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HidApi.Net.Tester", "HidApi.Net.Tester\HidApi.Net.Tester.csproj", "{D7FE837A-D24D-4D56-B538-CCC6968DDF1E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HidApi.Net.Tests", "HidApi.Net.Tests\HidApi.Net.Tests.csproj", "{3F7CF192-630B-4981-963A-6BA97F8C65EA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{5990F7E6-C6E7-41AB-BA83-5A17AAC91352}"
ProjectSection(SolutionItems) = preProject
..\docs\docfx.json = ..\docs\docfx.json
..\docs\toc.yml = ..\docs\toc.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -36,4 +43,7 @@ Global
{3F7CF192-630B-4981-963A-6BA97F8C65EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3F7CF192-630B-4981-963A-6BA97F8C65EA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{5990F7E6-C6E7-41AB-BA83-5A17AAC91352} = {289DF505-DAF0-4DEC-B19F-CD7E3B5737ED}
EndGlobalSection
EndGlobal

0 comments on commit 14a8587

Please sign in to comment.