Skip to content

Test Documentation #1017

Test Documentation

Test Documentation #1017

name: "Test Documentation"
on:
workflow_dispatch:
env:
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: true
jobs:
test_documentation:
timeout-minutes: 20
runs-on: ubuntu-latest
name: Build documentation
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.NYUW_TOKEN_GH }}
path: GitHub/DisCatSharp
- name: Checkout docs repository
uses: actions/checkout@v4
with:
repository: Aiko-IT-Systems/DisCatSharp.Docs
token: ${{ secrets.NYUW_TOKEN_GH }}
path: GitHub/DisCatSharp.Docs
ref: main
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: |
10.0.100-preview.1.25120.13
9.x
8.x
- name: Install DocFX
run: dotnet tool update -g docfx
continue-on-error: true
- name: Restore packages
run: dotnet restore --no-cache -f -v minimal DisCatSharp.sln
working-directory: GitHub/DisCatSharp
- name: Build library
run: dotnet build -c Release -v minimal -f net8.0 --no-restore DisCatSharp.sln
timeout-minutes: 7
continue-on-error: true
working-directory: GitHub/DisCatSharp
- name: Build Docs
run: docfx DisCatSharp.Docs/docfx.json
working-directory: GitHub/DisCatSharp
- name: Pack Docs
shell: pwsh
run: ./DisCatSharp.Tools/pack-docs.ps1 -DocsPath "./DisCatSharp.Docs" -OutputPath "./" -PackageName "dcs-docs-preview"
working-directory: GitHub/DisCatSharp
- name: Upload packed docs
uses: actions/[email protected]
with:
name: dcs-docs-preview.zip
path: GitHub/DisCatSharp/dcs-docs-preview.zip
retention-days: 2
- name: Create branch if not exists
run: |
git fetch origin
if git show-ref --verify refs/remotes/origin/${{ github.ref_name }}; then
echo "Branch exists"
git checkout -b ${{ github.ref_name }}
else
git checkout -b ${{ github.ref_name }}
git push origin ${{ github.ref_name }}
fi
working-directory: GitHub/DisCatSharp.Docs
- name: Purge old docs
shell: pwsh
run: Get-ChildItem -Exclude .git* | Remove-Item -Recurse -Force
working-directory: GitHub/DisCatSharp.Docs
- name: Download packed docs
uses: actions/download-artifact@v4
with:
name: dcs-docs-preview.zip
path: GitHub/DisCatSharp.Docs
- name: Extract new docs
run: unzip dcs-docs-preview.zip -d .
working-directory: GitHub/DisCatSharp.Docs
- name: Delete zip
run: rm dcs-docs-preview.zip
working-directory: GitHub/DisCatSharp.Docs
- name: Add .htaccess
run: rm -f .htaccess && wget https://gist.githubusercontent.com/Lulalaby/8a032d0ddebb9125691094edc67b6593/raw/0c4bf0423cfe334fdd5092b014d2481759dd052a/.htaccess
working-directory: GitHub/DisCatSharp.Docs
#- name: Add _redirects
# run: rm -f _redirects && wget https://gist.githubusercontent.com/Lulalaby/0c784680a855fd161411002e3859b4fd/raw/9708d1acfce3f647cbb8da19c2022a20198979fa/_redirects
- name: Set access rights
run: sudo chmod 777 -R .
working-directory: GitHub/DisCatSharp.Docs
- name: Commit changes
run: |
git config user.name NyuwBot
git config user.email [email protected]
git add .
git commit -m "Test-Docs update (https://github.com/${{ github.repository }}/commit/${{ github.sha }})"
git push --set-upstream origin ${{ github.ref_name }} -f
working-directory: GitHub/DisCatSharp.Docs
- name: Add PR Comment
if: always()
uses: mshick/add-pr-comment@v2
with:
refresh-message-position: true
message-success: |
Documentation test build passed! :tada:
Visit the cloudflare action run in https://github.com/Aiko-IT-Systems/DisCatSharp.Docs/commits/${{ github.ref_name }} for details :3
![gif](https://media.tenor.com/3PjRNS8paykAAAAC/pat-pat-head.gif)
message-failure: "Documentation test build failed! :x:"