-
Notifications
You must be signed in to change notification settings - Fork 64
57 lines (48 loc) · 1.52 KB
/
update-gh-pages-branch.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
50
51
52
53
54
55
56
57
name: update gh-pages branch
on:
workflow_dispatch:
jobs:
build-site:
runs-on: windows-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Check status
run: git status
- name: Download docfx
run: curl https://github.com/dotnet/docfx/releases/download/v2.59.2/docfx.zip -L -o ../docfx.zip
- name: Expand docfx
run: Expand-Archive ../docfx.zip -DestinationPath ../docfx
- name: Build site with docfx
run: ../docfx/docfx.exe build docfx.json --warningsAsErrors
- name: Archive site
run: Compress-Archive -Path _site/* -DestinationPath ${{ runner.temp }}/site.zip
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: github-pages
path: ${{ runner.temp }}/site.zip
publish-pages:
needs: build-site
runs-on: windows-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
with:
ref: gh-pages
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: github-pages
path: ../
- name: Clear directory
run: Get-ChildItem . -Recurse | Remove-Item -Force -Recurse
- name: Extract archive
run: Expand-Archive -Path ../site.zip -DestinationPath .
- name: Push changes to gh-pages
run: |
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -m "Pages update"
git push