Skip to content

Commit 14fc4d4

Browse files
updated
1 parent f0106cc commit 14fc4d4

File tree

6 files changed

+91
-0
lines changed

6 files changed

+91
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Deploy MkDocs to Netlify
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
build-and-deploy:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v6
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup Python
23+
uses: actions/setup-python@v6
24+
with:
25+
python-version: 'latest'
26+
cache: pip
27+
cache-dependency-path: requirements-docs.txt
28+
29+
- name: Install dependencies
30+
run: pip install -r requirements-docs.txt
31+
32+
- name: Generate MkDocs site
33+
run: |
34+
bash scripts/build_site.sh
35+
mkdocs build
36+
env:
37+
GOOGLE_ANALYTICS_ID: ${{ secrets.GOOGLE_ANALYTICS_ID }}
38+
39+
- name: Setup Node.js (for Netlify CLI)
40+
uses: actions/setup-node@v6
41+
with:
42+
node-version: lts/*
43+
44+
- name: Install Netlify CLI
45+
run: npm install -g netlify-cli
46+
47+
# Deploy preview for Pull Requests
48+
- name: Deploy preview to Netlify
49+
if: github.event_name == 'pull_request'
50+
run: netlify deploy --dir=site --message="PR ${{ github.event.number }} - Run ${{ github.run_number }}"
51+
env:
52+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
53+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
54+
55+
# Deploy to Production for Main branch pushes
56+
- name: Deploy to Netlify Production
57+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
58+
run: netlify deploy --prod --dir=site --message="Deploy Main - Run ${{ github.run_number }}"
59+
env:
60+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
61+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

docs/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Python Bro Code Documentation
2+
3+
Welcome to the Python Bro Code documentation site.
4+
5+
This site uses [MkDocs](https://mkdocs.org) and the [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) theme to serve documentation.

mkdocs.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
site_name: Python Bro Code Docs
2+
site_author: Pavan Mudigonda
3+
site_description: Documentation for Python Bro Code examples.
4+
5+
repo_name: pavanmudigonda/python-bro-code
6+
repo_url: https://github.com/pavanmudigonda/python-bro-code
7+
8+
theme:
9+
name: material
10+
11+
nav:
12+
- Home: index.md

netlify.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build]
2+
command = "pip install -r requirements-docs.txt && bash scripts/build_site.sh && mkdocs build"
3+
publish = "site"

requirements-docs.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
mkdocs>=1.4.2
2+
mkdocs-material>=9.0.0

scripts/build_site.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
# This script runs any pre-build steps before mkdocs build
4+
echo "Running pre-build steps for MkDocs..."
5+
6+
# Example: Auto-generate docs from source if needed
7+
# (Currently just a placeholder to satisfy the GitHub Action)
8+
exit 0

0 commit comments

Comments
 (0)