Skip to content

Commit 2240970

Browse files
committed
setup github action to build and deploy mkdocs
1 parent cba1094 commit 2240970

11 files changed

Lines changed: 198 additions & 50 deletions

File tree

.github/workflows/README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# GitHub Actions Workflows
2+
3+
## Documentation Deployment
4+
5+
The `docs.yml` workflow automatically builds and deploys the project documentation to GitHub Pages.
6+
7+
### Workflow Details
8+
9+
- **Trigger**: Runs on pushes to `master` branch, pull requests to master, and manual dispatch
10+
- **Build**: Uses Poetry to install dependencies and MkDocs to build the documentation
11+
- **Deploy**: Automatically deploys to GitHub Pages on pushes to master branch
12+
13+
### Setup Requirements
14+
15+
1. **GitHub Pages**: Enable GitHub Pages in your repository settings
16+
- Go to Settings → Pages
17+
- Set Source to "GitHub Actions"
18+
19+
2. **Dependencies**: The workflow uses:
20+
- Python 3.11
21+
- Poetry for dependency management
22+
- MkDocs Material theme
23+
- GitHub Actions for deployment
24+
25+
### Workflow Steps
26+
27+
1. **Build Job**:
28+
- Checkout repository
29+
- Set up Python and Poetry
30+
- Cache dependencies for faster builds
31+
- Install development dependencies
32+
- Build documentation with MkDocs
33+
- Upload build artifacts
34+
35+
2. **Deploy Job** (only on master):
36+
- Deploy artifacts to GitHub Pages
37+
- Set up custom domain if configured
38+
39+
### Local Testing
40+
41+
To test the documentation build locally:
42+
43+
```bash
44+
# Install dependencies
45+
poetry install --only=dev
46+
47+
# Build documentation
48+
poetry run mkdocs build --clean --strict
49+
50+
# Serve locally for development
51+
poetry run mkdocs serve
52+
```
53+
54+
### Configuration
55+
56+
The documentation is configured in:
57+
- `mkdocs.yml` - MkDocs configuration
58+
- `docs/` - Documentation source files
59+
- `site/` - Generated documentation (auto-generated, don't commit)
60+
61+
### Site URL
62+
63+
The documentation will be available at:
64+
`https://josephlim94.github.io/python_janus_client/`
65+
66+
### Branch Configuration
67+
68+
This workflow is configured to work with the `master` branch only:
69+
- Builds on pushes to master
70+
- Builds on pull requests targeting master
71+
- Deploys only from master branch

.github/workflows/docs.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build and Deploy Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: "pages"
19+
cancel-in-progress: false
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v4
30+
with:
31+
python-version: '3.11'
32+
33+
- name: Install Poetry
34+
uses: snok/install-poetry@v1
35+
with:
36+
version: latest
37+
virtualenvs-create: true
38+
virtualenvs-in-project: true
39+
40+
- name: Load cached venv
41+
id: cached-poetry-dependencies
42+
uses: actions/cache@v3
43+
with:
44+
path: .venv
45+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
46+
47+
- name: Install dependencies
48+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
49+
run: poetry install --only=dev
50+
51+
- name: Build documentation
52+
run: |
53+
poetry run mkdocs build --clean --strict
54+
55+
- name: Setup Pages
56+
if: github.ref == 'refs/heads/master'
57+
uses: actions/configure-pages@v3
58+
59+
- name: Upload artifact
60+
if: github.ref == 'refs/heads/master'
61+
uses: actions/upload-pages-artifact@v2
62+
with:
63+
path: ./site
64+
65+
deploy:
66+
if: github.ref == 'refs/heads/master'
67+
environment:
68+
name: github-pages
69+
url: ${{ steps.deployment.outputs.page_url }}
70+
runs-on: ubuntu-latest
71+
needs: build
72+
steps:
73+
- name: Deploy to GitHub Pages
74+
id: deployment
75+
uses: actions/deploy-pages@v2

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
site_name: Python Janus Client
22
site_description: Easily send and share WebRTC media through Janus WebRTC server.
3-
site_url: https://janus-client-in-python.readthedocs.io/
3+
site_url: https://josephlim94.github.io/python_janus_client/
44
repo_url: https://github.com/josephlim94/python_janus_client
55
repo_name: josephlim94/python_janus_client
66

site/404.html

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515

16-
<link rel="icon" href="/assets/python_janus_client_icon.svg">
16+
<link rel="icon" href="/python_janus_client/assets/python_janus_client_icon.svg">
1717
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.6.20">
1818

1919

@@ -22,10 +22,10 @@
2222

2323

2424

25-
<link rel="stylesheet" href="/assets/stylesheets/main.e53b48f4.min.css">
25+
<link rel="stylesheet" href="/python_janus_client/assets/stylesheets/main.e53b48f4.min.css">
2626

2727

28-
<link rel="stylesheet" href="/assets/stylesheets/palette.06af60db.min.css">
28+
<link rel="stylesheet" href="/python_janus_client/assets/stylesheets/palette.06af60db.min.css">
2929

3030

3131

@@ -44,7 +44,7 @@
4444

4545

4646

47-
<script>__md_scope=new URL("/",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
47+
<script>__md_scope=new URL("/python_janus_client/",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
4848

4949

5050

@@ -83,9 +83,9 @@
8383

8484
<header class="md-header" data-md-component="header">
8585
<nav class="md-header__inner md-grid" aria-label="Header">
86-
<a href="/." title="Python Janus Client" class="md-header__button md-logo" aria-label="Python Janus Client" data-md-component="logo">
86+
<a href="/python_janus_client/." title="Python Janus Client" class="md-header__button md-logo" aria-label="Python Janus Client" data-md-component="logo">
8787

88-
<img src="/assets/python_janus_client_icon.svg" alt="logo">
88+
<img src="/python_janus_client/assets/python_janus_client_icon.svg" alt="logo">
8989

9090
</a>
9191
<label class="md-header__button md-icon" for="__drawer">
@@ -230,7 +230,7 @@
230230

231231

232232
<li class="md-tabs__item">
233-
<a href="/." class="md-tabs__link">
233+
<a href="/python_janus_client/." class="md-tabs__link">
234234

235235

236236

@@ -249,7 +249,7 @@
249249

250250

251251
<li class="md-tabs__item">
252-
<a href="/session/" class="md-tabs__link">
252+
<a href="/python_janus_client/session/" class="md-tabs__link">
253253

254254

255255

@@ -268,7 +268,7 @@
268268

269269

270270
<li class="md-tabs__item">
271-
<a href="/plugins/" class="md-tabs__link">
271+
<a href="/python_janus_client/plugins/" class="md-tabs__link">
272272

273273

274274

@@ -287,7 +287,7 @@
287287

288288

289289
<li class="md-tabs__item">
290-
<a href="/transport/" class="md-tabs__link">
290+
<a href="/python_janus_client/transport/" class="md-tabs__link">
291291

292292

293293

@@ -322,9 +322,9 @@
322322

323323
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
324324
<label class="md-nav__title" for="__drawer">
325-
<a href="/." title="Python Janus Client" class="md-nav__button md-logo" aria-label="Python Janus Client" data-md-component="logo">
325+
<a href="/python_janus_client/." title="Python Janus Client" class="md-nav__button md-logo" aria-label="Python Janus Client" data-md-component="logo">
326326

327-
<img src="/assets/python_janus_client_icon.svg" alt="logo">
327+
<img src="/python_janus_client/assets/python_janus_client_icon.svg" alt="logo">
328328

329329
</a>
330330
Python Janus Client
@@ -351,7 +351,7 @@
351351

352352

353353
<li class="md-nav__item">
354-
<a href="/." class="md-nav__link">
354+
<a href="/python_janus_client/." class="md-nav__link">
355355

356356

357357

@@ -373,7 +373,7 @@
373373

374374

375375
<li class="md-nav__item">
376-
<a href="/session/" class="md-nav__link">
376+
<a href="/python_janus_client/session/" class="md-nav__link">
377377

378378

379379

@@ -395,7 +395,7 @@
395395

396396

397397
<li class="md-nav__item">
398-
<a href="/plugins/" class="md-nav__link">
398+
<a href="/python_janus_client/plugins/" class="md-nav__link">
399399

400400

401401

@@ -417,7 +417,7 @@
417417

418418

419419
<li class="md-nav__item">
420-
<a href="/transport/" class="md-nav__link">
420+
<a href="/python_janus_client/transport/" class="md-nav__link">
421421

422422

423423

@@ -525,10 +525,10 @@ <h1>404 - Not found</h1>
525525

526526

527527

528-
<script id="__config" type="application/json">{"base": "/", "features": ["content.action.edit", "content.action.view", "content.code.annotate", "content.code.copy", "content.tooltips", "navigation.footer", "navigation.indexes", "navigation.sections", "navigation.tabs", "navigation.top", "navigation.tracking", "search.highlight", "search.share", "search.suggest", "toc.follow"], "search": "/assets/javascripts/workers/search.973d3a69.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": {"provider": "mike"}}</script>
528+
<script id="__config" type="application/json">{"base": "/python_janus_client/", "features": ["content.action.edit", "content.action.view", "content.code.annotate", "content.code.copy", "content.tooltips", "navigation.footer", "navigation.indexes", "navigation.sections", "navigation.tabs", "navigation.top", "navigation.tracking", "search.highlight", "search.share", "search.suggest", "toc.follow"], "search": "/python_janus_client/assets/javascripts/workers/search.973d3a69.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": {"provider": "mike"}}</script>
529529

530530

531-
<script src="/assets/javascripts/bundle.f55a23d4.min.js"></script>
531+
<script src="/python_janus_client/assets/javascripts/bundle.f55a23d4.min.js"></script>
532532

533533

534534
</body>

site/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212

13-
<link rel="canonical" href="https://janus-client-in-python.readthedocs.io/">
13+
<link rel="canonical" href="https://josephlim94.github.io/python_janus_client/">
1414

1515

1616

site/plugins/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212

13-
<link rel="canonical" href="https://janus-client-in-python.readthedocs.io/plugins/">
13+
<link rel="canonical" href="https://josephlim94.github.io/python_janus_client/plugins/">
1414

1515

1616
<link rel="prev" href="../session/">

site/search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

site/session/index.html

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212

13-
<link rel="canonical" href="https://janus-client-in-python.readthedocs.io/session/">
13+
<link rel="canonical" href="https://josephlim94.github.io/python_janus_client/session/">
1414

1515

1616
<link rel="prev" href="..">
@@ -811,28 +811,30 @@ <h5 id="detach_pluginplugin"><code>detach_plugin(plugin)</code><a class="headerl
811811
<p><strong>Returns:</strong>
812812
- <code>Dict[str, Any]</code>: Response from Janus server confirming detachment</p>
813813
<h2 id="usage-example">Usage Example<a class="headerlink" href="#usage-example" title="Permanent link">&para;</a></h2>
814-
<p>```python
815-
import asyncio
816-
from janus_client import JanusSession, JanusEchoTestPlugin</p>
817-
<p>async def main():
818-
# Create session
819-
session = JanusSession(base_url="wss://example.com/janus")</p>
820-
<div class="language-text highlight"><pre><span></span><code>try:
821-
# Use session as async context manager for automatic cleanup
822-
async with session:
823-
# Create and attach plugin
824-
plugin = JanusEchoTestPlugin()
825-
await plugin.attach(session)
826-
827-
# Use plugin...
828-
829-
# Plugin will be automatically destroyed when session closes
830-
831-
except Exception as e:
832-
print(f&quot;Error: {e}&quot;)
833-
</code></pre></div>
834-
<p>if <strong>name</strong> == "<strong>main</strong>":
835-
asyncio.run(main())</p>
814+
<div class="language-python highlight"><pre><span></span><code><span id="__span-6-1"><a id="__codelineno-6-1" name="__codelineno-6-1" href="#__codelineno-6-1"></a><span class="kn">import</span> <span class="nn">asyncio</span>
815+
</span><span id="__span-6-2"><a id="__codelineno-6-2" name="__codelineno-6-2" href="#__codelineno-6-2"></a><span class="kn">from</span> <span class="nn">janus_client</span> <span class="kn">import</span> <span class="n">JanusSession</span><span class="p">,</span> <span class="n">JanusEchoTestPlugin</span>
816+
</span><span id="__span-6-3"><a id="__codelineno-6-3" name="__codelineno-6-3" href="#__codelineno-6-3"></a>
817+
</span><span id="__span-6-4"><a id="__codelineno-6-4" name="__codelineno-6-4" href="#__codelineno-6-4"></a><span class="k">async</span> <span class="k">def</span> <span class="nf">main</span><span class="p">():</span>
818+
</span><span id="__span-6-5"><a id="__codelineno-6-5" name="__codelineno-6-5" href="#__codelineno-6-5"></a> <span class="c1"># Create session</span>
819+
</span><span id="__span-6-6"><a id="__codelineno-6-6" name="__codelineno-6-6" href="#__codelineno-6-6"></a> <span class="n">session</span> <span class="o">=</span> <span class="n">JanusSession</span><span class="p">(</span><span class="n">base_url</span><span class="o">=</span><span class="s2">&quot;wss://example.com/janus&quot;</span><span class="p">)</span>
820+
</span><span id="__span-6-7"><a id="__codelineno-6-7" name="__codelineno-6-7" href="#__codelineno-6-7"></a>
821+
</span><span id="__span-6-8"><a id="__codelineno-6-8" name="__codelineno-6-8" href="#__codelineno-6-8"></a> <span class="k">try</span><span class="p">:</span>
822+
</span><span id="__span-6-9"><a id="__codelineno-6-9" name="__codelineno-6-9" href="#__codelineno-6-9"></a> <span class="c1"># Use session as async context manager for automatic cleanup</span>
823+
</span><span id="__span-6-10"><a id="__codelineno-6-10" name="__codelineno-6-10" href="#__codelineno-6-10"></a> <span class="k">async</span> <span class="k">with</span> <span class="n">session</span><span class="p">:</span>
824+
</span><span id="__span-6-11"><a id="__codelineno-6-11" name="__codelineno-6-11" href="#__codelineno-6-11"></a> <span class="c1"># Create and attach plugin</span>
825+
</span><span id="__span-6-12"><a id="__codelineno-6-12" name="__codelineno-6-12" href="#__codelineno-6-12"></a> <span class="n">plugin</span> <span class="o">=</span> <span class="n">JanusEchoTestPlugin</span><span class="p">()</span>
826+
</span><span id="__span-6-13"><a id="__codelineno-6-13" name="__codelineno-6-13" href="#__codelineno-6-13"></a> <span class="k">await</span> <span class="n">plugin</span><span class="o">.</span><span class="n">attach</span><span class="p">(</span><span class="n">session</span><span class="p">)</span>
827+
</span><span id="__span-6-14"><a id="__codelineno-6-14" name="__codelineno-6-14" href="#__codelineno-6-14"></a>
828+
</span><span id="__span-6-15"><a id="__codelineno-6-15" name="__codelineno-6-15" href="#__codelineno-6-15"></a> <span class="c1"># Use plugin...</span>
829+
</span><span id="__span-6-16"><a id="__codelineno-6-16" name="__codelineno-6-16" href="#__codelineno-6-16"></a>
830+
</span><span id="__span-6-17"><a id="__codelineno-6-17" name="__codelineno-6-17" href="#__codelineno-6-17"></a> <span class="c1"># Plugin will be automatically destroyed when session closes</span>
831+
</span><span id="__span-6-18"><a id="__codelineno-6-18" name="__codelineno-6-18" href="#__codelineno-6-18"></a>
832+
</span><span id="__span-6-19"><a id="__codelineno-6-19" name="__codelineno-6-19" href="#__codelineno-6-19"></a> <span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
833+
</span><span id="__span-6-20"><a id="__codelineno-6-20" name="__codelineno-6-20" href="#__codelineno-6-20"></a> <span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Error: </span><span class="si">{</span><span class="n">e</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
834+
</span><span id="__span-6-21"><a id="__codelineno-6-21" name="__codelineno-6-21" href="#__codelineno-6-21"></a>
835+
</span><span id="__span-6-22"><a id="__codelineno-6-22" name="__codelineno-6-22" href="#__codelineno-6-22"></a><span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span>
836+
</span><span id="__span-6-23"><a id="__codelineno-6-23" name="__codelineno-6-23" href="#__codelineno-6-23"></a> <span class="n">asyncio</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">main</span><span class="p">())</span>
837+
</span></code></pre></div>
836838

837839

838840

0 commit comments

Comments
 (0)