-
Notifications
You must be signed in to change notification settings - Fork 279
49 lines (44 loc) · 1.52 KB
/
publish-docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Publish GH - Pages
on:
push:
branches: [ main, release/v2.2, release/v2.3 ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set Docs Locations
id: branch
run: |
$branchName = "${{ github.ref }}"
# refs/heads/ is 11 characters
$branchName = $branchName.Substring(11)
if($branchName.StartsWith("release/"))
{
$branchName = $branchName.Substring(8)
}
elseif ($branchName -eq "main")
{
$branchName = ""
}
echo "::set-output name=DOCS_LOCATION::$branchName"
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- name: Install chocolatey
run: Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
- name: Install docfx
run: choco install docfx
- name: Run DocFx
run: docfx docfx/docfx.json
- name: Upload to GitHub Pages
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docfx/_site
destination_dir: ${{ steps.branch.outputs.DOCS_LOCATION }}
keep_files: true
full_commit_message: Deploy ${{ steps.branch.outputs.DOCS_LOCATION }} to GitHub Pages