Merge pull request #787 from pnp/main-import #720
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: Generate Site | |
on: | |
push: | |
branches: | |
# Only update docs for main branch pushes | |
- main | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
docfx: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# prevent parallel executions | |
- name: Wait for actions to finish | |
uses: softprops/turnstyle@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Checks-out main branch | |
- name: Checkout main branch | |
uses: actions/checkout@v2 | |
with: | |
ref: main | |
path: main | |
# Checks-out gh-pages branch | |
- name: Checkout gh-pages branch | |
uses: actions/checkout@v2 | |
with: | |
ref: gh-pages | |
path: gh-pages | |
# Install docfx, stick with version 2.51 as higher versions result in https://github.com/dotnet/docfx/issues/5785 > fixed in 2.56.4+ | |
- name: Install dependencies | |
run: | | |
wget https://github.com/dotnet/docfx/releases/download/v2.56.7/docfx.zip | |
sudo unzip docfx.zip -d /usr/local/lib/docfx | |
rm docfx.zip | |
echo '#!/bin/sh' | sudo tee -a /usr/local/bin/docfx > /dev/null | |
echo 'exec `which mono` $MONO_OPTIONS /usr/local/lib/docfx/docfx.exe "$@"' | sudo tee -a /usr/local/bin/docfx > /dev/null | |
sudo chmod +wx /usr/local/bin/docfx | |
sudo mkdir /usr/local/lib/docfx/plugins | |
sudo cp ./main/docfx/plugins/* /usr/local/lib/docfx/plugins | |
# Build docs | |
- name: Build docs | |
shell: pwsh | |
run: | | |
./main/docfx/build.ps1 | |
# Add, commit and push the changes | |
- name: Add & Commit & Push | |
uses: EndBug/add-and-commit@v6 | |
with: | |
# The directory where your repository is located. You should use actions/checkout first to set it up | |
cwd: ./gh-pages | |
branch: gh-pages | |
push: true | |
token: ${{ secrets.GITHUB_TOKEN }} |