1- name : Deploy MkDocs to Netlify
1+ # GitHub Actions workflow for deploying to Netlify
2+
3+ name : Deploy to Netlify
24
35on :
46 push :
57 branches :
68 - main
7- pull_request :
8- branches :
9- - main
10- workflow_dispatch :
119
1210jobs :
13- build-and- deploy :
11+ deploy :
1412 runs-on : ubuntu-latest
15-
1613 steps :
1714 - name : Checkout code
18- uses : actions/checkout@v6
19- with :
20- fetch-depth : 0
15+ uses : actions/checkout@v2
2116
22- - name : Setup Python
23- uses : actions/setup-python@v6
17+ - name : Set up Python
18+ uses : actions/setup-python@v4
2419 with :
25- python-version : ' latest'
26- cache : pip
27- cache-dependency-path : requirements-docs.txt
20+ python-version : ' 3.12'
2821
2922 - name : Install dependencies
30- run : pip install -r requirements-docs.txt
31-
32- - name : Generate MkDocs site
3323 run : |
34- bash scripts/build_site.sh
35- mkdocs build
36- env :
37- GOOGLE_ANALYTICS_ID : ${{ secrets.GOOGLE_ANALYTICS_ID }}
24+ pip install -r requirements.txt
3825
39- - name : Setup Node.js (for Netlify CLI)
40- uses : actions/setup-node@v6
26+ - name : Deploy to Netlify
27+ uses : netlify/ actions/cli@v2
4128 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 }}
29+ args : deploy --site=$NETLIFY_SITE_ID --auth=$NETLIFY_AUTH_TOKEN
0 commit comments