docs-publish #22
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: docs-publish | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
env: | |
DOTNET_VERSION: '8.0' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup environment | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Update docfx | |
run: dotnet tool update -g docfx | |
- name: Build | |
run: dotnet build | |
- name: Build documentation | |
run: docfx docs/docfx/docfx.json | |
- name: Copy website files, commit and push changes to BP.AdventureFramework-docs | |
run: | | |
mkdir BP.AdventureFramework-docs | |
cd BP.AdventureFramework-docs | |
git init | |
git remote add origin https://${{ secrets.PAT }}@github.com/benpollarduk/BP.AdventureFramework-docs.git | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git fetch | |
git checkout main | |
git rm -r --ignore-unmatch . | |
cp -r ../docs/docfx/_site/* . | |
git add . | |
git commit -m "Update documentation" | |
git push https://${{ secrets.PAT }}@github.com/benpollarduk/BP.AdventureFramework-docs.git HEAD:main | |