Skip to content

Commit 788d864

Browse files
updated
1 parent a6b8f5e commit 788d864

File tree

6 files changed

+664
-2370
lines changed

6 files changed

+664
-2370
lines changed

.github/workflows/deploy-netlify.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,16 @@ jobs:
2121
uses: actions/setup-python@v6
2222
with:
2323
python-version: '3.12'
24+
cache: pip
25+
cache-dependency-path: requirements-docs.txt
2426

25-
- name: Generate docs
26-
run: bash scripts/build_site.sh
27+
- name: Install dependencies
28+
run: pip install -r requirements-docs.txt
29+
30+
- name: Generate Sphinx site
31+
run: |
32+
bash scripts/build_site.sh
33+
sphinx-build -b html docs site
2734
2835
- name: Setup Node.js (for Netlify CLI)
2936
uses: actions/setup-node@v6
@@ -36,15 +43,15 @@ jobs:
3643
# Deploy preview for Pull Requests
3744
- name: Deploy preview to Netlify
3845
if: github.event_name == 'pull_request'
39-
run: netlify deploy --dir=docs --message="PR ${{ github.event.number }} - Run ${{ github.run_number }}"
46+
run: netlify deploy --dir=site --message="PR ${{ github.event.number }} - Run ${{ github.run_number }}"
4047
env:
4148
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
4249
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
4350

4451
# Deploy to Production for Main branch pushes
4552
- name: Deploy to Netlify Production
4653
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
47-
run: netlify deploy --prod --dir=docs --message="Deploy Main - Run ${{ github.run_number }}"
54+
run: netlify deploy --prod --dir=site --message="Deploy Main - Run ${{ github.run_number }}"
4855
env:
4956
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
5057
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

docs/index.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,76 @@ PyCharm IDE: https://www.jetbrains.com/pycharm/
148148

149149
*Copyright Disclaimer*:
150150
This video is the intellectual property of Bro Code. All rights reserved. No part of this video may be reproduced, distributed, or transmitted in any form or by any means, including but not limited to recording, uploading, or other electronic or mechanical methods, without my written permission, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law.
151+
152+
153+
```{toctree}
154+
:maxdepth: 2
155+
:caption: Chapters
156+
:hidden:
157+
158+
1-print
159+
2-variables
160+
3-type-casting
161+
4-user-input
162+
5-madlibs-game
163+
6-if-statements
164+
7-calculator
165+
8-weight-conversion
166+
9-temp-conversion
167+
10-logical-operators
168+
11-conditional-expressions
169+
12-string-methods
170+
13-string-indexing
171+
14-email-slicer
172+
15-format
173+
16-while
174+
17-interest-calculator
175+
18-for
176+
19-nested-loops
177+
20-timer
178+
21-lists-sets-tuples
179+
22-shopping-cart
180+
23-2d-collections
181+
24-quiz-game
182+
25-dictionaries
183+
26-concession-stand-program
184+
27-random-numbers
185+
28-number-guessing-game
186+
29-rock-paper-scissors-game
187+
30-dice-roller-program
188+
31-encryption-program
189+
32-functions
190+
33-default-arguments
191+
34-keyword-arguments
192+
35-args-kwargs
193+
36-iterables
194+
37-membership-operators
195+
38-list-comprehensions
196+
39-match-case-statements
197+
40-modules
198+
41-scope-resolution
199+
42-if-name-main
200+
43-credit-card-validator
201+
44-banking-program
202+
45-slot-machine
203+
46-hangman-game
204+
47-python-oop
205+
48-class-variables
206+
49-inheritance
207+
50-multiple-inheritance
208+
51-abstract-classes
209+
55-aggregation
210+
56-composition
211+
57-nested-classes
212+
63-lambda
213+
64-sorting
214+
65-zip
215+
66-recursion
216+
71-execution-time
217+
74-iterators
218+
75-generators
219+
76-generator-expressions
220+
77-data-classes
221+
92-qr-codes
222+
93-music-player
223+
```

netlify.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[build]
2-
command = "bash scripts/build_site.sh"
3-
publish = "docs"
2+
publish = "site"
3+
command = "pip install -r requirements-docs.txt && bash scripts/build_site.sh && sphinx-build -b html docs site"
4+
5+
[build.environment]
6+
PYTHON_VERSION = "3.12"

requirements-docs.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sphinx>=7.4.0
2+
furo>=2024.8.6
3+
myst-parser>=3.0.0
4+
sphinx-copybutton>=0.5.2
5+
sphinx-design>=0.6.0
6+
linkify-it-py>=2.0.0

scripts/generate_docs.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def main():
6565
folders.sort(key=lambda x: int(x.split('-')[0]))
6666

6767
chapter_count = 0
68+
generated_chapters = []
6869

6970
for folder in folders:
7071
readme_path = os.path.join(folder, "README.md")
@@ -98,8 +99,25 @@ def main():
9899
with open(doc_path, 'w', encoding='utf-8') as wf:
99100
wf.write(content)
100101

102+
generated_chapters.append(folder)
101103
chapter_count += 1
102-
104+
105+
# 3. Append MyST toctree to index.md for Sphinx navigation
106+
toctree_entries = "\n".join(generated_chapters)
107+
toctree_block = f"""
108+
109+
```{{toctree}}
110+
:maxdepth: 2
111+
:caption: Chapters
112+
:hidden:
113+
114+
{toctree_entries}
115+
```
116+
"""
117+
index_path = os.path.join(docs_dir, "index.md")
118+
with open(index_path, 'a', encoding='utf-8') as f:
119+
f.write(toctree_block)
120+
103121
print(f"Generated docs for Home + {chapter_count} chapters.")
104122

105123
if __name__ == '__main__':

0 commit comments

Comments
 (0)