-
Notifications
You must be signed in to change notification settings - Fork 26
131 lines (110 loc) · 4.2 KB
/
quarto-publish.yml
File metadata and controls
131 lines (110 loc) · 4.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# NOTE: We render the site in GitHub Actions because some pages (e.g., instructors.qmd)
# require R execution to pull dynamic data from CSV files. Netlify's build environment
# does not include R, so we cannot rely on the Quarto Netlify plugin for rendering.
# Instead, CI installs R + Quarto, renders the site, and deploys the pre-rendered HTML
# to Netlify for both PR previews and production.
name: CI/CD
on:
pull_request:
branches: [devel]
push:
branches: [devel]
schedule:
- cron: '0 1 * * 0' # every Sunday at 01:00 UTC
env:
cache-version: v1
jobs:
# Build & preview deploy for PRs
build-preview:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudunits2-dev libgdal-dev libgeos-dev libproj-dev
- name: Cache R packages
uses: actions/cache@v3
with:
path: ~/.R
key: ${{ env.cache-version }}-${{ runner.os }}-${{ hashFiles('**/DESCRIPTION', '**/renv.lock') }}
restore-keys: |
${{ env.cache-version }}-${{ runner.os }}-
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Install R dependencies
run: |
Rscript -e 'install.packages("remotes", repos = "https://cloud.r-project.org")'
Rscript -e 'remotes::install_deps(dependencies = TRUE)'
- name: Render Quarto Project
run: quarto render
- name: Deploy Preview to Netlify
run: |
npm install -g netlify-cli
netlify deploy \
--auth "$NETLIFY_AUTH_TOKEN" \
--site "$NETLIFY_SITE_ID" \
--dir docs \
--message "PR #${{ github.event.number }} - ${{ github.sha }}" \
--alias "pr-${{ github.event.number }}"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
# Production deploy on push/schedule to devel
deploy-prod:
if: github.ref == 'refs/heads/devel' && (github.event_name == 'push' || github.event_name == 'schedule')
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudunits2-dev libgdal-dev libgeos-dev libproj-dev
- name: Cache R packages
uses: actions/cache@v3
with:
path: ~/.R
key: ${{ env.cache-version }}-${{ runner.os }}-${{ hashFiles('**/DESCRIPTION', '**/renv.lock') }}
restore-keys: |
${{ env.cache-version }}-${{ runner.os }}-
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Install R dependencies
run: |
Rscript -e 'install.packages("remotes", repos = "https://cloud.r-project.org")'
Rscript -e 'remotes::install_deps(dependencies = TRUE)'
- name: Render Quarto Project
run: quarto render
# If you still want GitHub Pages in addition to Netlify, keep this step.
# Otherwise you can remove it and use Netlify as your sole host.
- name: Add CNAME for GitHub Pages custom domain
run: echo "training.bioconductor.org" > docs/CNAME
- name: Publish to GitHub Pages (optional)
uses: quarto-dev/quarto-actions/publish@v2
with:
target: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy Production to Netlify
run: |
npm install -g netlify-cli
netlify deploy \
--auth "$NETLIFY_AUTH_TOKEN" \
--site "$NETLIFY_SITE_ID" \
--dir docs \
--prod \
--message "devel @ ${{ github.sha }}"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}