Browse Source

feat: add docfx

pull/216/head
HueiFeng 5 years ago
parent
commit
09fab6817d
  1. 54
      .github/workflows/docfx.yml
  2. 68
      docfx.json
  3. 6
      toc.yml

54
.github/workflows/docfx.yml

@ -0,0 +1,54 @@
name: docfx build
on:
push:
branches:
- master
jobs:
build:
name: Build
runs-on: windows-latest
steps:
# Check out the branch that triggered this workflow to the 'source' subdirectory
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: master
path: source
- name: ReName README.MD
run: Get-ChildItem ./README.en.md | rename-item -newname 'index.md'
working-directory: ./source
- name: install DocFX
run: "& choco install docfx -y"
# Run a build
- name: Build docs
run: "& docfx ./docfx.json"
working-directory: ./source
# Check out gh-pages branch to the 'docs' subdirectory
- name: Checkout docs
uses: actions/checkout@v2
with:
ref: gh-pages
path: docs
# Sync the site
- name: Clear docs repo
run: Get-ChildItem -Force -Exclude .git | ForEach-Object { Remove-Item -Recurse -Verbose -Force $_ }
working-directory: ./docs
- name: Sync new content
run: Copy-Item -Recurse -Verbose -Force "$env:GITHUB_WORKSPACE/source/_site/*" "$env:GITHUB_WORKSPACE/docs"
working-directory: ./docs
# update docs
- name: Commit to gh-pages and push
run: |
$ErrorActionPreference = "Continue"
git add -A
git diff HEAD --exit-code
if ($LASTEXITCODE -eq 0) {
Write-Host "No changes to commit!"
} else {
git config --global user.name "github-actions-docfx[bot]"
git config --global user.email "hueifeng2020@outlook.com"
git commit -m "Updated docs from commit $env:GITHUB_SHA on $env:GITHUB_REF"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git push origin gh-pages
}
working-directory: ./docs

68
docfx.json

@ -0,0 +1,68 @@
{
"metadata": [
{
"src": [
{
"files": [
"src/Magicodes.ExporterAndImporter.Csv/**/*.cs",
"src/Magicodes.ExporterAndImporter.Excel/**/*.cs",
"src/Magicodes.ExporterAndImporter.PDF/**/*.cs",
"src/Magicodes.ExporterAndImporter.HTML/**/*.cs",
"src/Magicodes.ExporterAndImporter.Word/**/*.cs",
]
}
],
"dest": "api",
"disableGitFeatures": false,
"disableDefaultFilter": false
}
],
"build": {
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
},
{
"files": [
"articles/**.md",
"articles/**/toc.yml",
"toc.yml",
"*.md"
]
}
],
"resource": [
{
"files": [
"images/**"
]
}
],
"overwrite": [
{
"files": [
"apidoc/**.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"dest": "_site",
"globalMetadataFiles": [],
"fileMetadataFiles": [],
"template": [
"default"
],
"postProcessors": [],
"markdownEngineName": "markdig",
"noLangKeyword": false,
"keepFileLink": false,
"cleanupCacheHistory": false,
"disableGitFeatures": false
}
}

6
toc.yml

@ -0,0 +1,6 @@
- name: Home
href: index.md
- name: API Documentation
href: api/
- name: Release Notes
href: Release.md
Loading…
Cancel
Save