From 7b6f171053255b0ecb92cd261d12a70e27f9d4f0 Mon Sep 17 00:00:00 2001
From: rdipardo <59004801+rdipardo@users.noreply.github.com>
Date: Sun, 22 Sep 2024 22:14:10 -0400
Subject: [PATCH] Add docfx workflow
---
.github/workflows/docfx.yml | 48 ++++++++++++++++++++++++++++++++
.gitignore | 2 ++
REUSE.toml | 2 +-
docfx.json | 54 ++++++++++++++++++++++++++++++++++++
lib/Npp.DotNet.Plugin.csproj | 2 +-
lib/README.md.license | 2 --
lib/index.md | 3 ++
lib/toc.yml | 5 ++++
test/Memory/Memory.csproj | 6 ++--
9 files changed, 117 insertions(+), 7 deletions(-)
create mode 100644 .github/workflows/docfx.yml
create mode 100644 docfx.json
delete mode 100644 lib/README.md.license
create mode 100644 lib/index.md
create mode 100644 lib/toc.yml
diff --git a/.github/workflows/docfx.yml b/.github/workflows/docfx.yml
new file mode 100644
index 0000000..02cfe7d
--- /dev/null
+++ b/.github/workflows/docfx.yml
@@ -0,0 +1,48 @@
+# SPDX-FileCopyrightText: Public Domain
+# SPDX-License-Identifier: CC0-1.0
+
+name: API Docs
+
+on:
+ push:
+ paths:
+ - 'lib/**/*.cs'
+ - 'docfx.json'
+ - '.github/workflows/docfx.yml'
+
+permissions:
+ actions: read
+ pages: write
+ id-token: write
+
+jobs:
+ publish-docs:
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ runs-on: windows-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: 8.0.x
+
+ - name: Generate docs
+ run: |
+ dotnet tool update -g docfx
+ dotnet restore
+ docfx
+ env:
+ DOCFX_SOURCE_BRANCH_NAME: ${{ github.ref_name }}
+
+ - name: Setup Pages
+ uses: actions/configure-pages@v5
+
+ - name: Upload artifact
+ uses: actions/upload-pages-artifact@v3
+ with:
+ path: './_site'
+
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v4
diff --git a/.gitignore b/.gitignore
index c5a22a7..0bbc68c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -189,6 +189,8 @@ DocProject/Help/html
publish/
# Publish Web Output
+**/api/
+_site/
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
diff --git a/REUSE.toml b/REUSE.toml
index 50e0198..625e0e4 100644
--- a/REUSE.toml
+++ b/REUSE.toml
@@ -12,7 +12,7 @@ SPDX-FileCopyrightText = "2004 Apache Software Foundation"
SPDX-License-Identifier = "Apache-2.0"
[[annotations]]
-path = ["**.json", "doc/**", "lib/**.png", "**/CODEOWNERS", "README**", "NOTICE**"]
+path = ["**.json", "doc/**", "lib/**.md", "lib/**.png", "lib/**.yml", "**/CODEOWNERS", "README**", "NOTICE**"]
precedence = "aggregate"
SPDX-FileCopyrightText = "Public Domain"
SPDX-License-Identifier = "CC0-1.0"
diff --git a/docfx.json b/docfx.json
new file mode 100644
index 0000000..499936c
--- /dev/null
+++ b/docfx.json
@@ -0,0 +1,54 @@
+{
+ "metadata": [
+ {
+ "src": [
+ {
+ "src": "lib",
+ "files": [
+ "**/*.csproj"
+ ]
+ }
+ ],
+ "dest": "lib/api",
+ "properties": {
+ "TargetFramework": "net481",
+ "DefineConstants": "SCI_DISABLE_PROVISIONAL"
+ }
+ }
+ ],
+ "build": {
+ "content": [
+ {
+ "files": [
+ "**/*.{md,yml}"
+ ],
+ "src": "lib",
+ "dest": "." ,
+ "exclude": [
+ "_site/**"
+ ]
+ }
+ ],
+ "resource": [
+ {
+ "files": [
+ "lib/*.{ico,png,svg}"
+ ]
+ }
+ ],
+ "output": "_site",
+ "template": [
+ "statictoc",
+ "modern"
+ ],
+ "globalMetadata": {
+ "_appFaviconPath": "lib/brand.png",
+ "_appName": "Npp.DotNet.Plugin",
+ "_appTitle": "Npp.DotNet.Plugin",
+ "_enableSearch": true,
+ "_disableContribution": true,
+ "pdf": false
+ }
+ },
+ "disableGitFeatures": true
+}
diff --git a/lib/Npp.DotNet.Plugin.csproj b/lib/Npp.DotNet.Plugin.csproj
index 74712ca..c0f5e19 100644
--- a/lib/Npp.DotNet.Plugin.csproj
+++ b/lib/Npp.DotNet.Plugin.csproj
@@ -8,7 +8,7 @@
AOT-ready port of the .NET Framework plugin template for Notepad++
README.md
brand.png
- https://github.com/npp-dotnet
+ https://npp-dotnet.github.io/Npp.DotNet.Plugin
https://github.com/npp-dotnet/npp.dotnet.plugin
git
Apache-2.0
diff --git a/lib/README.md.license b/lib/README.md.license
deleted file mode 100644
index aff8490..0000000
--- a/lib/README.md.license
+++ /dev/null
@@ -1,2 +0,0 @@
- SPDX-FileCopyrightText: Public Domain
- SPDX-License-Identifier: CC0-1.0
\ No newline at end of file
diff --git a/lib/index.md b/lib/index.md
new file mode 100644
index 0000000..8970115
--- /dev/null
+++ b/lib/index.md
@@ -0,0 +1,3 @@
+---
+redirect_url: /api/Npp.DotNet.Plugin.html
+---
diff --git a/lib/toc.yml b/lib/toc.yml
new file mode 100644
index 0000000..0428af2
--- /dev/null
+++ b/lib/toc.yml
@@ -0,0 +1,5 @@
+- name: Home
+ href: README.md
+
+- name: API
+ href: api/
diff --git a/test/Memory/Memory.csproj b/test/Memory/Memory.csproj
index 46ec8a6..dad579c 100644
--- a/test/Memory/Memory.csproj
+++ b/test/Memory/Memory.csproj
@@ -10,9 +10,9 @@
-
-
-
+
+
+