update gh-pages branch #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |