Skip to content

Commit 793db44

Browse files
updatd
1 parent db46484 commit 793db44

File tree

1 file changed

+44
-12
lines changed

1 file changed

+44
-12
lines changed
Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,61 @@
1-
# GitHub Actions workflow for deploying to Netlify
2-
3-
name: Deploy to Netlify
1+
name: Deploy MkDocs to Netlify
42

53
on:
64
push:
75
branches:
86
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
911

1012
jobs:
11-
deploy:
13+
build-and-deploy:
1214
runs-on: ubuntu-latest
15+
1316
steps:
1417
- name: Checkout code
15-
uses: actions/checkout@v2
18+
uses: actions/checkout@v6
19+
with:
20+
fetch-depth: 0
1621

17-
- name: Set up Python
18-
uses: actions/setup-python@v4
22+
- name: Setup Python
23+
uses: actions/setup-python@v6
1924
with:
20-
python-version: '3.12'
25+
python-version: 'latest'
26+
cache: pip
27+
cache-dependency-path: requirements-docs.txt
2128

2229
- name: Install dependencies
30+
run: pip install -r requirements-docs.txt
31+
32+
- name: Generate MkDocs site
2333
run: |
24-
pip install -r requirements.txt
34+
bash scripts/build_site.sh
35+
mkdocs build
36+
env:
37+
GOOGLE_ANALYTICS_ID: ${{ secrets.GOOGLE_ANALYTICS_ID }}
2538

26-
- name: Deploy to Netlify
27-
uses: netlify/actions/cli@v2
39+
- name: Setup Node.js (for Netlify CLI)
40+
uses: actions/setup-node@v6
2841
with:
29-
args: deploy --site=$NETLIFY_SITE_ID --auth=$NETLIFY_AUTH_TOKEN
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 }}

0 commit comments

Comments
 (0)