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