From dc9e77d0abc350255c83ee9ee2c6af41c6c3d0fd Mon Sep 17 00:00:00 2001 From: Battlefield Duck Date: Sun, 21 Jan 2024 07:28:07 +0800 Subject: [PATCH] Implement docfx for Documentation --- .github/workflows/docfx-gh-pages.yml | 56 ++++++++++++++++++++++++++++ docs/.gitignore | 4 ++ docs/docfx.json | 45 ++++++++++++++++++++++ docs/docs/getting-started.md | 1 + docs/docs/introduction.md | 1 + docs/docs/toc.yml | 4 ++ docs/index.md | 11 ++++++ docs/toc.yml | 4 ++ 8 files changed, 126 insertions(+) create mode 100644 .github/workflows/docfx-gh-pages.yml create mode 100644 docs/.gitignore create mode 100644 docs/docfx.json create mode 100644 docs/docs/getting-started.md create mode 100644 docs/docs/introduction.md create mode 100644 docs/docs/toc.yml create mode 100644 docs/index.md create mode 100644 docs/toc.yml diff --git a/.github/workflows/docfx-gh-pages.yml b/.github/workflows/docfx-gh-pages.yml new file mode 100644 index 0000000..2d51645 --- /dev/null +++ b/.github/workflows/docfx-gh-pages.yml @@ -0,0 +1,56 @@ +# Workflow for deploying docfx to GitHub Pages +name: Deploy docfx to GitHub Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + + # The workflow will only run when there are changes in the 'docs' or 'OpenGSQ' folders + paths: + - 'docs/**' + - 'OpenGSQ/**' + + # Allows you to run this workflow manually from the Actions tab + 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: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Dotnet Setup + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.x + + - run: dotnet tool update -g docfx + - run: docfx docs/docfx.json + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + # Upload entire repository + path: "docs/_site" + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..3b124e1 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,4 @@ +# Docfx +.cache +/_site/ +/api/ diff --git a/docs/docfx.json b/docs/docfx.json new file mode 100644 index 0000000..108e823 --- /dev/null +++ b/docs/docfx.json @@ -0,0 +1,45 @@ +{ + "metadata": [ + { + "src": [ + { + "src": "../OpenGSQ", + "files": [ + "**/*.csproj" + ] + } + ], + "dest": "api" + } + ], + "build": { + "content": [ + { + "files": [ + "**/*.{md,yml}" + ], + "exclude": [ + "_site/**" + ] + } + ], + "resource": [ + { + "files": [ + "images/**" + ] + } + ], + "output": "_site", + "template": [ + "default", + "modern" + ], + "globalMetadata": { + "_appName": "OpenGSQ", + "_appTitle": "OpenGSQ", + "_enableSearch": true, + "pdf": true + } + } +} \ No newline at end of file diff --git a/docs/docs/getting-started.md b/docs/docs/getting-started.md new file mode 100644 index 0000000..8b3a794 --- /dev/null +++ b/docs/docs/getting-started.md @@ -0,0 +1 @@ +# Getting Started \ No newline at end of file diff --git a/docs/docs/introduction.md b/docs/docs/introduction.md new file mode 100644 index 0000000..f6ecaa6 --- /dev/null +++ b/docs/docs/introduction.md @@ -0,0 +1 @@ +# Introduction \ No newline at end of file diff --git a/docs/docs/toc.yml b/docs/docs/toc.yml new file mode 100644 index 0000000..d7e9ea8 --- /dev/null +++ b/docs/docs/toc.yml @@ -0,0 +1,4 @@ +- name: Introduction + href: introduction.md +- name: Getting Started + href: getting-started.md \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..f9859f8 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,11 @@ +--- +_layout: landing +--- + +# This is the **HOMEPAGE**. + +Refer to [Markdown](http://daringfireball.net/projects/markdown/) for how to write markdown files. + +## Quick Start Notes: + +1. Add images to the *images* folder if the file is referencing an image. \ No newline at end of file diff --git a/docs/toc.yml b/docs/toc.yml new file mode 100644 index 0000000..061acc6 --- /dev/null +++ b/docs/toc.yml @@ -0,0 +1,4 @@ +- name: Docs + href: docs/ +- name: API + href: api/ \ No newline at end of file