-
Notifications
You must be signed in to change notification settings - Fork 7
149 lines (120 loc) · 3.67 KB
/
Copy pathquarto-publish.yml
File metadata and controls
149 lines (120 loc) · 3.67 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
name: Render and Publish
permissions:
contents: read
pages: write
id-token: write
jobs:
lint:
name: Lint with Prettier
runs-on: ubuntu-24.04
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
run: npm install
- name: Check for linting errors
run: npm run check
build-optimize:
name: Build, Optimize, and Upload Artifacts
runs-on: ubuntu-24.04
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Overwrite _quarto.yml
if: github.repository == 'maehr/open-research-data-template'
run: |
cp .github/_quarto.yml _quarto.yml
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# To install LaTeX to build PDF book outputs, uncomment below
tinytex: true
# uncomment below and fill to pin a version
# version: SPECIFIC-QUARTO-VERSION-HERE
# add software dependencies here and any libraries
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
- name: Create and activate virtual environment
run: |
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Install the project
run: uv sync
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: Set R environment variables for precompiled binaries
run: |
echo "RENV_CONFIG_PAK_ENABLED=TRUE" >> $GITHUB_ENV
echo "RENV_CONFIG_PREFER_BINARY=TRUE" >> $GITHUB_ENV
echo "RENV_CONFIG_PACKAGE_CACHE=TRUE" >> $GITHUB_ENV
- uses: r-lib/actions/setup-renv@v2
with:
cache-version: 1
- name: Render Quarto Project
uses: quarto-dev/quarto-actions/render@v2
with:
path: .
- name: JamPack Optimization
run: |
npx @divriots/jampack ./_site
- name: Upload Built Artifacts
uses: actions/upload-artifact@v4
with:
name: built-site
path: _site
- name: Upload static files as artifact
id: deployment
uses: actions/upload-pages-artifact@v3 # or specific "vX.X.X" version tag for this action
with:
path: _site
deadlinkcheck:
name: Download Artifacts and Check for Dead Links
runs-on: ubuntu-24.04
needs: build-optimize
steps:
- name: Download Built Artifacts
uses: actions/download-artifact@v4
with:
name: built-site
path: _site
- name: Start static server
run: |
cd _site
nohup python3 -m http.server 5528 &
sleep 3 # Give the server time to start
- name: Check for broken links
run: |
wget --spider --recursive --no-parent --no-check-certificate http://localhost:5528/ || exit 1
deploy:
name: Download Artifacts and Deploy
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-24.04
needs: [build-optimize, deadlinkcheck]
if: github.event_name != 'pull_request'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4