diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..5bb2c54e --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,41 @@ +name: Docs +on: + push: + branches: [main] + workflow_dispatch: +concurrency: + group: "docs" + cancel-in-progress: true +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + - name: Setup DocFx + run: dotnet tool update -g docfx && dotnet tool restore + - name: Build Docs + run: ./BuildScripts~/build_docs.sh + - name: Configure Pages + uses: actions/configure-pages@v5 + - name: Upload Generated Docs + uses: actions/upload-pages-artifact@v3 + with: + path: Documentation~/_site + deploy: + needs: build + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/BuildScripts~/build_docs.sh b/BuildScripts~/build_docs.sh new file mode 100755 index 00000000..88631fa1 --- /dev/null +++ b/BuildScripts~/build_docs.sh @@ -0,0 +1,21 @@ +#!/bin/bash +DOCS_DIR=../Documentation~/ +GITHUB_DIR=../.github/ +README_PATH=../README.md + +# Copy README and required images +mkdir -p $DOCS_DIR/resources && cp $GITHUB_DIR/*.png $DOCS_DIR/resources/ +cp $README_PATH $DOCS_DIR/index.md + +# Build docs +docfx $DOCS_DIR/docfx.json + +# Patch image paths +find $DOCS_DIR/_site -name '*.html' -type f -exec sed -i.bak 's|=\"/.github/|=\"resources/|g' {} \; +find $DOCS_DIR/_site -name '*.bak' -type f -delete + +# Cleanup +rm -rf $DOCS_DIR/api/*.yml +rm -rf $DOCS_DIR/api/.manifest +rm -rf $DOCS_DIR/resources +rm -rf $DOCS_DIR/index.md diff --git a/Documentation~/.gitignore b/Documentation~/.gitignore new file mode 100644 index 00000000..d708bbe0 --- /dev/null +++ b/Documentation~/.gitignore @@ -0,0 +1,6 @@ +resources +index.md +api/*.yml +api/.manifest +/**/_site/ +.cache \ No newline at end of file diff --git a/Documentation~/api/.gitkeep b/Documentation~/api/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Documentation~/custom/public/main.css b/Documentation~/custom/public/main.css new file mode 100644 index 00000000..6e1e7d27 --- /dev/null +++ b/Documentation~/custom/public/main.css @@ -0,0 +1,3 @@ +#logo { + display: none; +} \ No newline at end of file diff --git a/Documentation~/docfx.json b/Documentation~/docfx.json new file mode 100644 index 00000000..7943e444 --- /dev/null +++ b/Documentation~/docfx.json @@ -0,0 +1,42 @@ +{ + "metadata": [ + { + "src": [ + { + "files": ["Runtime/Scripts/**/*.cs"], + "src": "../" + } + ], + "dest": "api", + "disableDefaultFilter": false, + "allowCompilationErrors": true + } + ], + "build": { + "content": [ + { + "files": "**/*.{md,yml}", + "src": "api", + "dest": "api" + }, + { + "files": ["toc.yml", "*.md"] + } + ], + "resource": [{ "files": ["resources/**"] }], + "output": "_site", + "template": ["default", "modern", "custom"], + "globalMetadata": { + "_appName": "LiveKit Unity SDK", + "_appTitle": "LiveKit Unity SDK", + "_appFooter": "LiveKit Client SDK for Unity", + "_lang": "en", + "_enableSearch": true, + "pdf": false + }, + "xrefService": ["https://xref.docs.microsoft.com/query?uid={uid}"], + "sitemap": { + "baseUrl": "https://docs.livekit.io/reference/client-sdk-unity/" + } + } +} diff --git a/Documentation~/toc.yml b/Documentation~/toc.yml new file mode 100644 index 00000000..cb2d80d7 --- /dev/null +++ b/Documentation~/toc.yml @@ -0,0 +1,4 @@ +- name: About + href: / +- name: API Reference + href: api/ \ No newline at end of file