From c359655c3a10a32e8551e1373e41e2f1f8a12c6e Mon Sep 17 00:00:00 2001 From: Robert Campbell Date: Fri, 5 Jan 2024 14:42:38 -0500 Subject: [PATCH] Updated docfx tooling and template --- .github/workflows/docs-publish2.yml | 60 +++++++++ docfx.json | 43 +++---- template/layout/_master.tmpl | 171 +++++++++++++++++++++++++ template/partials/footer.tmpl.partial | 31 ----- template/partials/logo.tmpl.partial | 6 - template/partials/scripts.tmpl.partial | 17 --- template/{styles => public}/main.css | 8 +- toc.yml | 2 +- 8 files changed, 257 insertions(+), 81 deletions(-) create mode 100644 .github/workflows/docs-publish2.yml create mode 100644 template/layout/_master.tmpl delete mode 100644 template/partials/footer.tmpl.partial delete mode 100644 template/partials/logo.tmpl.partial delete mode 100644 template/partials/scripts.tmpl.partial rename template/{styles => public}/main.css (92%) diff --git a/.github/workflows/docs-publish2.yml b/.github/workflows/docs-publish2.yml new file mode 100644 index 0000000..7d11fe4 --- /dev/null +++ b/.github/workflows/docs-publish2.yml @@ -0,0 +1,60 @@ +name: Publish Documentation + +on: + push: + branches: + - main + - docfx_update + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: Checkout docs host repo + uses: actions/checkout@v2 + with: + repository: ezEngine/docs + path: _site + fetch-depth: 1 + persist-credentials: false + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + + - name: Clear docs host repo + run: rm -rf _site/* + + - name: Get docfx + run: | + dotnet tool update -g docfx + - name: Build docs + run: | + docfx build + cp CNAME _site/CNAME + - name: Commit + run: | + export GIT_COMMITTER_NAME=$(git show -s --format='%cn') + export GIT_COMMITTER_EMAIL=$(git show -s --format='%ce') + export GIT_AUTHOR_NAME=$(git show -s --format='%an') + export GIT_AUTHOR_EMAIL=$(git show -s --format='%ae') + export COMMIT_HASH=$(git show -s --format='%H') + export SUBJECT=$(git show -s --format='%s') + cd _site + git add . + git commit -m "$SUBJECT" -m "Original commit: $COMMIT_HASH" + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.API_TOKEN_GITHUB }} + branch: main + directory: _site + repository: ezEngine/docs + force: true diff --git a/docfx.json b/docfx.json index e97caf8..ab6cd40 100644 --- a/docfx.json +++ b/docfx.json @@ -1,6 +1,4 @@ { - "metadata": [ - ], "build": { "content": [ { @@ -9,6 +7,9 @@ "pages/**/*.yml", "toc.yml", "*.md" + ], + "exclude": [ + "_site/**" ] } ], @@ -20,28 +21,22 @@ ] } ], - "overwrite": [ - ], - "dest": "_site", + "output": "_site", + "exportViewModel": true, + "template": [ "default", "modern", "template" ], "globalMetadata": { - "_appTitle": "ezEngine", - "_appLogoPath": "assets/images/EZ-text.svg", - "_appFaviconPath": "assets/images/favicon.svg", - "_enableSearch": true, - "_enableGoogleAnalytics": true, - "_enableNewTab": true - }, - "globalMetadataFiles": [], - "fileMetadataFiles": [], - "template": [ - "default", - "template" - ], - "postProcessors": [], - "markdownEngineName": "markdig", - "noLangKeyword": false, - "keepFileLink": false, - "cleanupCacheHistory": false, - "disableGitFeatures": false + "_appName": "ezEngine", + "_appTitle": "ezEngine", + "_appLogoPath": "assets/images/EZ-text.svg", + "_appFaviconPath": "assets/images/favicon.svg", + "_enableSearch": true, + "_enableGoogleAnalytics": true, + "_enableNewTab": true, + "_appFooter": "Hello", + "_gitContribute": { + "repo": "https://github.com/ezEngine/docs-src", + "branch": "main" + } + } } } \ No newline at end of file diff --git a/template/layout/_master.tmpl b/template/layout/_master.tmpl new file mode 100644 index 0000000..e2bf944 --- /dev/null +++ b/template/layout/_master.tmpl @@ -0,0 +1,171 @@ +{{!Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license.}} +{{!include(/^public/.*/)}} +{{!include(favicon.ico)}} +{{!include(logo.svg)}} + + + + + {{#redirect_url}} + + {{/redirect_url}} + {{^redirect_url}} + {{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}} + + + {{#_description}}{{/_description}} + + + + + + {{#_noindex}}{{/_noindex}} + {{#_enableSearch}}{{/_enableSearch}} + {{#_disableNewTab}}{{/_disableNewTab}} + {{#_disableTocFilter}}{{/_disableTocFilter}} + {{#docurl}}{{/docurl}} + + + + + + + + + + + + + {{/redirect_url}} + + + {{^redirect_url}} + + + + + {{#_googleAnalyticsTagId}} + + + {{/_googleAnalyticsTagId}} + + +
+ +
+ +
+
+
+
+
Table of Contents
+ +
+
+ +
+
+
+ +
+
+ + + +
+ +
+ {{!body}} +
+ + {{^_disableContribution}} +
+ {{#sourceurl}} + {{__global.improveThisDoc}} + {{/sourceurl}} + {{^sourceurl}}{{#docurl}} + {{__global.improveThisDoc}} + {{/docurl}}{{/sourceurl}} +
+ {{/_disableContribution}} + + {{^_disableNextArticle}} + + {{/_disableNextArticle}} + +
+ +
+ +
+
+ + {{#_enableSearch}} +
+ {{/_enableSearch}} + + + + {{/redirect_url}} + \ No newline at end of file diff --git a/template/partials/footer.tmpl.partial b/template/partials/footer.tmpl.partial deleted file mode 100644 index d7f2eb5..0000000 --- a/template/partials/footer.tmpl.partial +++ /dev/null @@ -1,31 +0,0 @@ -{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}} - - diff --git a/template/partials/logo.tmpl.partial b/template/partials/logo.tmpl.partial deleted file mode 100644 index 933ca00..0000000 --- a/template/partials/logo.tmpl.partial +++ /dev/null @@ -1,6 +0,0 @@ -{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}} - - - - - diff --git a/template/partials/scripts.tmpl.partial b/template/partials/scripts.tmpl.partial deleted file mode 100644 index fd1d53c..0000000 --- a/template/partials/scripts.tmpl.partial +++ /dev/null @@ -1,17 +0,0 @@ -{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}} - - - - - - -{{#_enableGoogleAnalytics}} - -{{/_enableGoogleAnalytics}} \ No newline at end of file diff --git a/template/styles/main.css b/template/public/main.css similarity index 92% rename from template/styles/main.css rename to template/public/main.css index 3f2b171..8dba2bf 100644 --- a/template/styles/main.css +++ b/template/public/main.css @@ -22,6 +22,10 @@ span.footer-logo a { background-repeat: no-repeat; } +footer .pull-right { + float: right; +} + #logo_ez { background-image: url('https://raw.githubusercontent.com/ezEngine/docs/main/assets/images/EZ-logo.svg'); } @@ -42,8 +46,8 @@ span.footer-logo a { background-image: url('https://raw.githubusercontent.com/ezEngine/docs/main/assets/images/logo-youtube.svg'); } -footer { - background-color: #222; +header, footer { + background-color: #222 !important; border-color: #080808; } diff --git a/toc.yml b/toc.yml index 0d2df3c..ca404dc 100644 --- a/toc.yml +++ b/toc.yml @@ -5,6 +5,6 @@ - name: Samples href: pages/samples/ - name: Contact - homepage: pages/contact.md + href: pages/contact.md - name: Github href: https://github.com/ezEngine/ezEngine \ No newline at end of file