Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port from bookdown to quarto #365

Merged
merged 23 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
61c4b61
use yaml formatted chunk options
djnavarro May 2, 2023
9938d31
enforce sentence-level markdown wraping locally
djnavarro May 2, 2023
5647d99
ignore *_cache and *_files folders
djnavarro May 2, 2023
baf9684
canonicalise facets chapter markdown
djnavarro May 2, 2023
1077075
replace _bookdown.yml and _output.yml with _quarto.yml
djnavarro May 2, 2023
ac43b71
canonicalise getting-started
djnavarro May 2, 2023
9cced55
fixes level 1 headers in chapter files
djnavarro May 2, 2023
a371487
spurious newline diffs
djnavarro May 2, 2023
8a2d601
canonicalise references
djnavarro May 2, 2023
fb74b02
remove yaml header and canonicalise index.Rmd
djnavarro May 2, 2023
c3a4f46
use quarto on gh actions
djnavarro May 2, 2023
c551974
use @ notation for cross-references and sec- prefix for section labels
djnavarro May 2, 2023
78b87d6
restore references.Rmd to document structure
djnavarro May 2, 2023
81c4ae5
tweak heading to fix inscrutable quarto bug
djnavarro May 4, 2023
1510ad1
removes columns() function, uses quarto layout-ncols instead
djnavarro May 4, 2023
1ab7b2a
adds status() function and set.seed() to common.R, and updates chapte…
djnavarro May 4, 2023
795d4ea
remove refs chapter (each chapter has its own refs)
djnavarro May 4, 2023
be922ce
fix broken crossrefs
djnavarro May 4, 2023
93b977d
adds "welcome to part" file for part 1
djnavarro May 4, 2023
1442889
removes status note from part headers where it makes no sense to have…
djnavarro May 4, 2023
c55e81f
tentatively assign some chapters to status: polishing
djnavarro May 4, 2023
a0773bd
removes spurious heading
djnavarro May 4, 2023
6be7625
fixes silly mistakes in the gh actions
djnavarro May 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,51 +1,54 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
branches: main
pull_request:
branches: [main, master]
branches: main
# to be able to trigger a manual build
workflow_dispatch:
schedule:
# run every day at 11 PM
- cron: '0 23 * * *'

name: bookdown
name: Render and deploy Book to Netlify

env:
isExtPR: ${{ github.event.pull_request.head.repo.fork == true }}
RUST_BACKTRACE: 1

jobs:
bookdown:
build-deploy:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
isExtPR: ${{ github.event.pull_request.head.repo.fork == true }}

steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2
- name: Install Quarto
uses: quarto-dev/quarto-actions/install-quarto@v1
with:
# To install LaTeX to build PDF book
tinytex: true
# uncomment below and fill to pin a version
# version: 0.9.105

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2

- name: Cache bookdown results
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you deliberately drop the caching? I have no idea if it's important or not.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semi-deliberate. I'm not entirely sure what (if any) files need to be cached in the quarto book, and since there's no caching used in the r4ds book workflow (which I was using as a guide) I didn't try to add anything. Maybe we leave it as is and try restoring the cache later if we have build issues?

Copy link
Collaborator Author

@djnavarro djnavarro May 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having now merged I can see why we had a cache. The actions workflow takes about 20 mins to finish and I had timeout issues the first time. I'll open an issue to restore the cache and see what needs to happen. Edit: Issue is #366

uses: actions/cache@v3
with:
path: _bookdown_files
key: bookdown-${{ hashFiles('**/*Rmd') }}
restore-keys: bookdown-

- name: Build site
run: Rscript -e 'bookdown::render_book("index.Rmd", quiet = TRUE)'
- name: Render book to all format
# Add any command line argument needed
run: |
quarto render

- name: Deploy to Netlify
if: contains(env.isExtPR, 'false')
id: netlify-deploy
uses: nwtgck/[email protected]
with:
publish-dir: './_book'
production-branch: master
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message:
'Deploy from GHA: ${{ github.event.pull_request.title || github.event.head_commit.message }} (${{ github.sha }})'
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
.Rproj.user
.Rhistory
book/ggplot2-book.pdf
_cache
temp.Rmd
rsconnect
www
Expand All @@ -17,3 +16,8 @@ _main.aux
_main.idx
_main.out
_main.toc

/.quarto/
*_cache
*_files
_main.Rmd
40 changes: 0 additions & 40 deletions _bookdown.yml

This file was deleted.

32 changes: 0 additions & 32 deletions _output.yml

This file was deleted.

76 changes: 76 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
project:
type: book
output-dir: _book

book:
title: "ggplot2: Elegant Graphics for Data Analysis (3e)"
reader-mode: true

page-footer:
left: |
ggplot2: Elegant Graphics for Data Analysis (3e) was written by
Hadley Wickham, Danielle Navarro, and Thomas Lin Pedersen.
right: |
This book was built with <a href="https://quarto.org/">Quarto</a>.
cover-image: cover.jpg
favicon: cover.jpg
site-url: https://ggplot2-book.org/
repo-url: https://github.com/hadley/ggplot2-book/
repo-branch: main
repo-actions: [edit, issue]
chapters:
- index.Rmd

- preface-3e.Rmd
- preface-2e.Rmd

- part: start.Rmd
chapters:
- introduction.Rmd
- getting-started.Rmd

- part: toolbox.Rmd
chapters:
- individual-geoms.Rmd
- collective-geoms.Rmd
- statistical-summaries.Rmd
- maps.Rmd
- networks.Rmd
- annotations.Rmd
- arranging-plots.Rmd

- part: scales.Rmd
chapters:
- scales-position.Rmd
- scales-colour.Rmd
- scales-other.Rmd

- part: mastery.Rmd
chapters:
- layers.Rmd
- scales-guides.Rmd
- coord.Rmd
- facet.Rmd
- themes.Rmd

- part: extending.Rmd
chapters:
- programming.Rmd
- internals.Rmd
- extensions.Rmd
- ext-springs.Rmd

bibliography: references.bib

format:
html:
theme:
- cosmo
code-link: true

author-meta: "Hadley Wickham, Danielle Navarro, and Thomas Lin Pedersen"
include-in-header: "ga_script.html"
callout-appearance: simple

editor: visual

Loading