-
Notifications
You must be signed in to change notification settings - Fork 4
108 lines (90 loc) · 3.26 KB
/
quarto-publish.yml
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
on:
push:
branches: main
name: Render and Publish
jobs:
build-deploy:
runs-on: ubuntu-latest
concurrency:
group: pages-deploy
cancel-in-progress: true
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
# To install LaTeX to build PDF book
tinytex: true
# uncomment below and fill to pin a version
# version: 0.9.600
# add software dependencies here
- name: Set up R
uses: r-lib/actions/setup-r@v2
- name: Install system dependencies
run: sudo apt-get install -y libcurl4-openssl-dev
- name: Cache Renv packages
uses: actions/cache@v2
with:
path: ~/R/Library
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- name: Restore R package dependencies with renv
run: |
Rscript -e "install.packages('renv')"
Rscript -e "renv::restore()"
# set the file modification times to the time of the last commit for every file
# This did not work as expected, so deactivated. But left in case we want to come back to it.
# - name: Fix timestamps
# run: bash .github/scripts/fix-timestamps.sh
- name: Install Barlow font
run: |
mkdir -p ~/.local/share/fonts
wget -qO- https://github.com/google/fonts/raw/main/ofl/barlow/Barlow-Regular.ttf > ~/.local/share/fonts/Barlow-Regular.ttf
wget -qO- https://github.com/google/fonts/raw/main/ofl/barlow/Barlow-Bold.ttf > ~/.local/share/fonts/Barlow-Bold.ttf
fc-cache -f -v
- name: Publish to GitHub Pages (and render)
uses: quarto-dev/quarto-actions/publish@v2
with:
target: gh-pages
env:
QUARTO_PROFILE: html
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Render PDF
# uses: quarto-dev/quarto-actions/render@v2
# with:
# to: pdf
# path: .
# env:
# QUARTO_PROFILE: pdf
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Manually Render PDF
run: quarto render --profile pdf --output-dir _book
# Debug: List files after rendering PDF
- name: List files after rendering PDF
run: |
ls -l
find . -name "*.pdf"
- name: Checkout gh-pages branch
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages
# Copy the PDF to the gh-pages directory
- name: Copy PDF to gh-pages directory
run: |
cp ./_book/*.pdf gh-pages/
# Debug: List files in gh-pages directory
- name: List files in gh-pages directory
run: |
ls -l gh-pages
find gh-pages -name "*.pdf"
- name: Commit and Push PDF to gh-pages
working-directory: ./gh-pages
run: |
git config user.email "[email protected]"
git config user.name "GitHub Action"
git add -f *.pdf
git commit -m "Automatically generated PDF" -a || echo "No changes to commit"
git push origin gh-pages