Skip to content

Commit 1537597

Browse files
authored
Add CI pipeline for Quarto PR preview (#19)
1 parent e3bd52b commit 1537597

File tree

2 files changed

+51
-16
lines changed

2 files changed

+51
-16
lines changed

.github/workflows/preview.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Quarto PR preview
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types:
8+
- opened
9+
- reopened
10+
- synchronize
11+
- ready_for_review
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
actions: write # needed to allow julia-actions/cache to delete old caches that it has created
18+
contents: write # needed for Quarto render
19+
pull-requests: write # for GitHub action bot to write messages
20+
if: ${{ !github.event.pull_request.draft }}
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up Quarto
24+
uses: quarto-dev/quarto-actions/setup@v2
25+
- uses: julia-actions/setup-julia@v2
26+
with:
27+
version: '1'
28+
- uses: julia-actions/cache@v2
29+
- uses: julia-actions/julia-buildpkg@v1
30+
with:
31+
precompile: true
32+
- uses: cardinalby/export-env-action@v2
33+
with:
34+
envFile: '_environment'
35+
expand: 'true'
36+
- name: Quarto Render
37+
uses: quarto-dev/quarto-actions/render@v2
38+
with:
39+
to: html
40+
- name: Deploy PR Preview
41+
uses: rossjrw/[email protected]
42+
with:
43+
source-dir: ./_output/
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Quarto Build
22

3-
on: # either one of the following four cases
3+
on: # either one of the following three cases
44
workflow_dispatch: # manually trigger
55

66
schedule:
@@ -9,22 +9,12 @@ on: # either one of the following four cases
99
push:
1010
branches: main
1111

12-
pull_request:
13-
branches:
14-
- main
15-
types:
16-
- opened
17-
- reopened
18-
- synchronize
19-
- ready_for_review
20-
2112
jobs:
2213
build:
2314
runs-on: ubuntu-latest
2415
permissions:
2516
actions: write # needed to allow julia-actions/cache to delete old caches that it has created
2617
contents: write # needed for Quarto render
27-
if: ${{ !github.event.pull_request.draft }}
2818
steps:
2919
- uses: actions/checkout@v4
3020
- name: Set up Quarto
@@ -44,11 +34,11 @@ jobs:
4434
uses: quarto-dev/quarto-actions/render@v2
4535
with:
4636
to: html
47-
- name: Quarto Publish
48-
if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
49-
uses: quarto-dev/quarto-actions/publish@v2
37+
- name: Deploy page
38+
uses: JamesIves/github-pages-deploy-action@v4
5039
with:
51-
render: 'false' # rendered in the previous step already
52-
target: gh-pages
40+
folder: _output/
41+
clean-exclude: pr-preview/
42+
force: false
5343
env:
5444
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)