-
Notifications
You must be signed in to change notification settings - Fork 36
74 lines (60 loc) 路 2.2 KB
/
Copy pathdeploy.yml
File metadata and controls
74 lines (60 loc) 路 2.2 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
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Build and Deploy
on:
push:
branches: ['**']
pull_request:
branches: [master]
schedule:
# Weekly build-health check; deploy steps only run on push events,
# so this catches library breakage without touching production.
- cron: '0 6 * * 1'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
HAS_CF_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN != '' }}
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: 'release'
use-public-rspm: true
- name: Install R packages
run: R -e "install.packages(c('ggplot2', 'mgcv'))"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install Python dependencies
run: uv sync
- name: Install Chrome for Kaleido
run: uv run kaleido_get_chrome
- name: Run tests
run: uv run pytest tests/ -v
- name: Execute notebook
run: uv run jupyter nbconvert --to notebook --execute Examples.ipynb --output Examples.build.ipynb
- name: Render site
run: uv run python render.py Examples.build.ipynb
- name: Deploy to Cloudflare Pages (Production)
if: github.ref == 'refs/heads/master' && github.event_name == 'push' && env.HAS_CF_TOKEN == 'true'
uses: cloudflare/wrangler-action@v4
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy web --project-name=pythonplot --branch=main
- name: Deploy to Cloudflare Pages (Preview)
if: github.ref != 'refs/heads/master' && env.HAS_CF_TOKEN == 'true'
uses: cloudflare/wrangler-action@v4
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy web --project-name=pythonplot --branch=${{ github.head_ref || github.ref_name }}
- name: Upload build artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: site-build
path: web/
retention-days: 7