Skip to contents

A platform-agnostic method of deploying a lesson website and cached content. This function takes advantage of git worktrees to render and push content to orphan branches, which can be used to host the lesson website. This function assumes that you are in a git clone from a remote and have write access to that remote.

Usage

ci_deploy(
  path = ".",
  md_branch = "md-outputs",
  site_branch = "gh-pages",
  remote = "origin",
  reset = FALSE
)

Arguments

path

path to the lesson

md_branch

the branch name that contains the markdown outputs

site_branch

the branch name that contains the full HTML site

remote

the name of the git remote to which you should deploy.

reset

if TRUE, the markdown cache is cleared before rebuilding, this defaults to FALSE meaning the markdown cache will be provisioned and used.

Value

Nothing, invisibly. This is used for it's side-effect

Details

ci_deploy() does the same thing as build_lesson(), except instead of storing the outputs under the site/ folder, it pushes the outputs to remote orphan branches (determined by the md_branch and site_branch arguments). These branches are used as the cache and the website, respectively. If these branches do not exist, they will be created.

Requirements

This function can only run in a non-interactive fashion. If you try to run it interactively, you will get an error message. It assumes that the following are true:

  • it is running in a script or automated workflow

  • it is running in a clone of a git repository

  • the remote exists and is writable

Unexpected consequences can arise from violating these assumptions.

Workflow

This function has a similar two-step workflow as build_lesson(), with a few extra steps to ensure that the git branches are set up correctly. Below are the steps with elements common to build_lesson() annotated with *

  1. check that a git user and email is registered

  2. * Validate the lesson and generate global variables with validate_lesson()

  3. provision, build, and deploy markdown branch with ci_build_markdown() i. provision markdown branch with git_worktree_setup() ii. * build the markdown source documents with build_markdown() iii. commit and push the git worktree to the remote branch with github_worktree_commit()

  4. provision, build, and deploy site branch with ci_build_site() i. provision site branch with git_worktree_setup() ii. * build the site HTML documents with build_site() iii. commit and push the git worktree to the remote branch with github_worktree_commit() iv. remove the git worktree with github_worktree_remove()

  5. remove markdown git worktree with github_worktree_remove()

Note

this function is not for interactive use. It requires git to be installed on your machine and will destroy anything you have in the site/ folder. For R-based lessons it will rebuild all components if the lockfile has changed.

Examples

# For this example, we are setting up a temporary repository with a local
# remote called `sandpaper-local`. This demonstrates how `ci_deploy()`
# modifies the remote, but there are setup and teardown steps to run.
# The actual example is highlighted below under the DEPLOY comment.

# SETUP -------------------------------------------------------------------
snd <- asNamespace("sandpaper")
tik <- Sys.time()
cli::cli_h1("Set up")
#> 
#> ── Set up ──────────────────────────────────────────────────────────────
cli::cli_h2("Create Lesson")
#> 
#> ── Create Lesson ──
#> 
restore_fixture <- snd$create_test_lesson()
#> → Bootstrapping example lesson
#>  Lesson bootstrapped in 3.269563 secs
#> → Bootstrapping example lesson

res <- getOption("sandpaper.test_fixture")
cli::cli_h2("Create Remote")
#> 
#> ── Create Remote ──
#> 
rmt <- fs::file_temp(pattern = "REMOTE-")
snd$setup_local_remote(repo = res, remote = rmt, verbose = FALSE)
#>  Remote set up in 0.01770735 secs
tok <- Sys.time()
cli::cli_alert_info("Elapsed time: {round(tok - tik, 2)} seconds")
#>  Elapsed time: 3.32 seconds

# reporting -----
# The repository should only have one branch and the remote should be in
# sync with the local.
cli::cli_h2("Local status")
#> 
#> ── Local status ──
#> 
gert::git_branch_list(repo = res)[c('name', 'commit', 'updated')]
#> # A tibble: 2 × 3
#>   name                 commit                        updated            
#>   <chr>                <chr>                         <dttm>             
#> 1 main                 121aaab1f8ea51501edd2e212c7f… 2024-04-19 13:10:11
#> 2 sandpaper-local/main 121aaab1f8ea51501edd2e212c7f… 2024-04-19 13:10:11
cli::cli_h2("First episode status")
#> ── First episode status ──
#> 
gert::git_stat_files("episodes/introduction.Rmd", repo = res)
#> # A tibble: 1 × 5
#>   file             created             modified            commits head 
#> * <chr>            <dttm>              <dttm>                <int> <chr>
#> 1 episodes/introd… 2024-04-19 13:10:11 2024-04-19 13:10:11       1 121a…
gert::git_stat_files("episodes/introduction.Rmd", repo = rmt)
#> # A tibble: 1 × 5
#>   file             created             modified            commits head 
#> * <chr>            <dttm>              <dttm>                <int> <chr>
#> 1 episodes/introd… 2024-04-19 13:10:11 2024-04-19 13:10:11       1 121a…

# DEPLOY ------------------------------------------------------------------
tik <- Sys.time()
cli::cli_h1("deploy to remote")
#> ── deploy to remote ────────────────────────────────────────────────────
sandpaper:::ci_deploy(path = res, remote = "sandpaper-local")
#> ── Validating Fenced Divs ──────────────────────────────────────────────
#> ── Validating Internal Links and Images ────────────────────────────────
#> ::group::Create New Branch
#> Running git checkout --orphan md-outputs
#> Switched to a new branch 'md-outputs'
#> Running git rm -rf --quiet .
#> Running git commit --allow-empty -m 'Initializing md-outputs branch'
#> [md-outputs (root-commit) c69f51c] Initializing md-outputs branch
#> Running git push sandpaper-local 'HEAD:md-outputs'
#> To /tmp/Rtmpy58M2t/REMOTE-18762aa7cc19
#>  * [new branch]      HEAD -> md-outputs
#> Running git checkout main
#> Your branch is up to date with 'sandpaper-local/main'.
#> Switched to branch 'main'
#> ::endgroup::
#> ::group::Fetch sandpaper-local/md-outputs
#> Running git remote set-branches sandpaper-local md-outputs
#> Running git fetch sandpaper-local md-outputs
#> From /tmp/Rtmpy58M2t/REMOTE-18762aa7cc19
#>  * branch            md-outputs -> FETCH_HEAD
#> Running git remote set-branches sandpaper-local '*'
#> ::endgroup::
#> ::group::Add worktree for sandpaper-local/md-outputs in site/built
#> Running git worktree add --track -B md-outputs \
#>   /tmp/Rtmpy58M2t/file18762171f4b9/lesson-example/site/built \
#>   sandpaper-local/md-outputs
#> Preparing worktree (resetting branch 'md-outputs'; was at c69f51c)
#> branch 'md-outputs' set up to track 'sandpaper-local/md-outputs'.
#> HEAD is now at c69f51c Initializing md-outputs branch
#> ::endgroup::
#> ::group::Build Markdown Sources
#>  Consent to use package cache provided
#> → Searching for and installing available dependencies
#> Finding R package dependencies ... Done!
#> → Restoring any dependency versions
#> - The library is already synchronized with the lockfile.
#> → Recording changes in lockfile
#> - The lockfile is already up to date.
#>  Using package cache in /home/runner/.cache/R/renv
#> 
#> 
#> processing file: /tmp/Rtmpy58M2t/file18762171f4b9/lesson-example/episodes/introduction.Rmd
#> 1/3          
#> 2/3 [pyramid]
#> 3/3          
#> output file: /tmp/Rtmpy58M2t/file18762171f4b9/lesson-example/site/built/introduction.md
#> 
#> ::endgroup::
#> ::group::Commit Markdown Sources
#> Running git commit --allow-empty -m \
#>   'markdown source builds
#> 
#> Auto-generated via {sandpaper}
#> Source  : 121aaab1f8ea51501edd2e212c7f5758935754a2
#> Branch  : main
#> Author  : carpenter <team@carpentries.org>
#> Time    : 2024-04-19 13:10:11 +0000
#> Message : Initial commit [via {sandpaper}]
#> '
#> [md-outputs 2d37db0] markdown source builds
#>  13 files changed, 731 insertions(+)
#>  create mode 100644 CODE_OF_CONDUCT.md
#>  create mode 100644 LICENSE.md
#>  create mode 100644 config.yaml
#>  create mode 100644 fig/introduction-rendered-pyramid-1.png
#>  create mode 100644 index.md
#>  create mode 100644 instructor-notes.md
#>  create mode 100644 introduction.md
#>  create mode 100644 learner-profiles.md
#>  create mode 100644 links.md
#>  create mode 100644 md5sum.txt
#>  create mode 100644 reference.md
#>  create mode 100644 renv.lock
#>  create mode 100644 setup.md
#> Running git remote -v
#> sandpaper-local	/tmp/Rtmpy58M2t/REMOTE-18762aa7cc19 (fetch)
#> sandpaper-local	/tmp/Rtmpy58M2t/REMOTE-18762aa7cc19 (push)
#> Running git push --force sandpaper-local 'HEAD:md-outputs'
#> To /tmp/Rtmpy58M2t/REMOTE-18762aa7cc19
#>    c69f51c..2d37db0  HEAD -> md-outputs
#> ::endgroup::
#> ::group::Create New Branch
#> Running git checkout --orphan gh-pages
#> Switched to a new branch 'gh-pages'
#> Running git rm -rf --quiet .
#> Running git commit --allow-empty -m 'Initializing gh-pages branch'
#> [gh-pages (root-commit) 7b46662] Initializing gh-pages branch
#> Running git push sandpaper-local 'HEAD:gh-pages'
#> To /tmp/Rtmpy58M2t/REMOTE-18762aa7cc19
#>  * [new branch]      HEAD -> gh-pages
#> Running git checkout main
#> Your branch is up to date with 'sandpaper-local/main'.
#> Switched to branch 'main'
#> ::endgroup::
#> ::group::Fetch sandpaper-local/gh-pages
#> Running git remote set-branches sandpaper-local gh-pages
#> Running git fetch sandpaper-local gh-pages
#> From /tmp/Rtmpy58M2t/REMOTE-18762aa7cc19
#>  * branch            gh-pages   -> FETCH_HEAD
#> Running git remote set-branches sandpaper-local '*'
#> ::endgroup::
#> ::group::Add worktree for sandpaper-local/gh-pages in site/docs
#> Running git worktree add --track -B gh-pages \
#>   /tmp/Rtmpy58M2t/file18762171f4b9/lesson-example/site/docs \
#>   sandpaper-local/gh-pages
#> Preparing worktree (resetting branch 'gh-pages'; was at 7b46662)
#> branch 'gh-pages' set up to track 'sandpaper-local/gh-pages'.
#> HEAD is now at 7b46662 Initializing gh-pages branch
#> ::endgroup::
#> ::group::Build Lesson Website
#>  pandoc found
#>   version : 3.1.11
#>   path    : /opt/hostedtoolcache/pandoc/3.1.11/x64
#> ── Initialising site ───────────────────────────────────────────────────
#> Copying
#> ../../../../../home/runner/work/_temp/Library/pkgdown/BS3/assets/bootstrap-toc.css,
#> ../../../../../home/runner/work/_temp/Library/pkgdown/BS3/assets/bootstrap-toc.js,
#> ../../../../../home/runner/work/_temp/Library/pkgdown/BS3/assets/docsearch.css,
#> ../../../../../home/runner/work/_temp/Library/pkgdown/BS3/assets/docsearch.js,
#> ../../../../../home/runner/work/_temp/Library/pkgdown/BS3/assets/link.svg,
#> ../../../../../home/runner/work/_temp/Library/pkgdown/BS3/assets/pkgdown.css,
#> and
#> ../../../../../home/runner/work/_temp/Library/pkgdown/BS3/assets/pkgdown.js
#> to bootstrap-toc.css, bootstrap-toc.js, docsearch.css, docsearch.js,
#> link.svg, pkgdown.css, and pkgdown.js
#> Copying
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/android-chrome-192x192.png,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/android-chrome-512x512.png,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/apple-touch-icon.png,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/assets/fonts/Mulish-Bold.ttf,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/assets/fonts/Mulish-Bold.woff,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/assets/fonts/Mulish-ExtraBold.ttf,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/assets/fonts/mulish-v5-latin-regular.eot,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/assets/fonts/mulish-v5-latin-regular.svg,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/assets/fonts/mulish-v5-latin-regular.ttf,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/assets/fonts/mulish-v5-latin-regular.woff,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/assets/fonts/mulish-v5-latin-regular.woff2,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/assets/fonts/mulish-variablefont_wght.woff,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/assets/fonts/mulish-variablefont_wght.woff2,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/assets/images/carpentries-logo-sm.svg,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/assets/images/carpentries-logo.svg,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/assets/images/data-logo-sm.svg,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/assets/images/data-logo.svg,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/assets/images/dropdown-arrow.svg,
#> …,
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/safari-pinned-tab.svg,
#> and
#> ../../../../../home/runner/work/_temp/Library/varnish/pkgdown/assets/site.webmanifest
#> to android-chrome-192x192.png, android-chrome-512x512.png,
#> apple-touch-icon.png, assets/fonts/Mulish-Bold.ttf,
#> assets/fonts/Mulish-Bold.woff, assets/fonts/Mulish-ExtraBold.ttf,
#> assets/fonts/mulish-v5-latin-regular.eot,
#> assets/fonts/mulish-v5-latin-regular.svg,
#> assets/fonts/mulish-v5-latin-regular.ttf,
#> assets/fonts/mulish-v5-latin-regular.woff,
#> assets/fonts/mulish-v5-latin-regular.woff2,
#> assets/fonts/mulish-variablefont_wght.woff,
#> assets/fonts/mulish-variablefont_wght.woff2,
#> assets/images/carpentries-logo-sm.svg,
#> assets/images/carpentries-logo.svg, assets/images/data-logo-sm.svg,
#> assets/images/data-logo.svg, assets/images/dropdown-arrow.svg, …,
#> safari-pinned-tab.svg, and site.webmanifest
#> ── Scanning episodes to rebuild ────────────────────────────────────────
#> Writing `instructor/CODE_OF_CONDUCT.html`
#> Writing `CODE_OF_CONDUCT.html`
#> Writing `instructor/LICENSE.html`
#> Writing `LICENSE.html`
#> Writing `instructor/introduction.html`
#> Writing `introduction.html`
#> Writing `instructor/reference.html`
#> Writing `reference.html`
#> ── Creating 404 page ───────────────────────────────────────────────────
#> Writing `instructor/404.html`
#> Writing `404.html`
#> ── Creating learner profiles ───────────────────────────────────────────
#> Writing `instructor/profiles.html`
#> Writing `profiles.html`
#> ── Creating homepage ───────────────────────────────────────────────────
#> Writing `instructor/index.html`
#> Writing `index.html`
#> ── Creating keypoints summary ──────────────────────────────────────────
#> Writing 'instructor/key-points.html'
#> Writing 'key-points.html'
#> ── Creating All-in-one page ────────────────────────────────────────────
#> Writing 'instructor/aio.html'
#> Writing 'aio.html'
#> ── Creating Images page ────────────────────────────────────────────────
#> Writing 'instructor/images.html'
#> Writing 'images.html'
#> ── Creating Instructor Notes ───────────────────────────────────────────
#> Writing 'instructor/instructor-notes.html'
#> Writing 'instructor-notes.html'
#> ── Creating sitemap.xml ────────────────────────────────────────────────
#> 
#> Output created: /tmp/Rtmpy58M2t/file18762171f4b9/lesson-example/site/docs/index.html
#> ::endgroup::
#> ::group::Commit Lesson Website
#> Running git commit --allow-empty -m \
#>   'site deploy
#> 
#> Auto-generated via {sandpaper}
#> Source  : 2d37db032a39b0b7e9855c118c6e409f5bbdc249
#> Branch  : md-outputs
#> Author  : GitHub Actions <actions@github.com>
#> Time    : 2024-04-19 13:10:15 +0000
#> Message : markdown source builds
#> 
#> Auto-generated via {sandpaper}
#> Source  : 121aaab1f8ea51501edd2e212c7f5758935754a2
#> Branch  : main
#> Author  : carpenter <team@carpentries.org>
#> Time    : 2024-04-19 13:10:11 +0000
#> Message : Initial commit [via {sandpaper}]
#> '
#> [gh-pages 6841aa1] site deploy
#>  148 files changed, 10643 insertions(+)
#>  create mode 100644 .nojekyll
#>  create mode 100644 404.html
#>  create mode 100644 CODE_OF_CONDUCT.html
#>  create mode 100644 LICENSE.html
#>  create mode 100644 aio.html
#>  create mode 100644 android-chrome-192x192.png
#>  create mode 100644 android-chrome-512x512.png
#>  create mode 100644 apple-touch-icon.png
#>  create mode 100644 assets/fonts/Mulish-Bold.ttf
#>  create mode 100644 assets/fonts/Mulish-Bold.woff
#>  create mode 100644 assets/fonts/Mulish-ExtraBold.ttf
#>  create mode 100644 assets/fonts/mulish-v5-latin-regular.eot
#>  create mode 100644 assets/fonts/mulish-v5-latin-regular.svg
#>  create mode 100644 assets/fonts/mulish-v5-latin-regular.ttf
#>  create mode 100644 assets/fonts/mulish-v5-latin-regular.woff
#>  create mode 100644 assets/fonts/mulish-v5-latin-regular.woff2
#>  create mode 100644 assets/fonts/mulish-variablefont_wght.woff
#>  create mode 100644 assets/fonts/mulish-variablefont_wght.woff2
#>  create mode 100644 assets/images/carpentries-logo-sm.svg
#>  create mode 100644 assets/images/carpentries-logo.svg
#>  create mode 100644 assets/images/data-logo-sm.svg
#>  create mode 100644 assets/images/data-logo.svg
#>  create mode 100644 assets/images/dropdown-arrow.svg
#>  create mode 100644 assets/images/incubator-logo-sm.svg
#>  create mode 100644 assets/images/incubator-logo.svg
#>  create mode 100644 assets/images/lab-logo-sm.svg
#>  create mode 100644 assets/images/lab-logo.svg
#>  create mode 100644 assets/images/library-logo-sm.svg
#>  create mode 100644 assets/images/library-logo.svg
#>  create mode 100644 assets/images/minus.svg
#>  create mode 100644 assets/images/plus.svg
#>  create mode 100644 assets/images/software-logo-sm.svg
#>  create mode 100644 assets/images/software-logo.svg
#>  create mode 100644 assets/scripts.js
#>  create mode 100644 assets/styles.css
#>  create mode 100644 assets/styles.css.map
#>  create mode 100644 bootstrap-toc.css
#>  create mode 100644 bootstrap-toc.js
#>  create mode 100644 config.yaml
#>  create mode 100644 docsearch.css
#>  create mode 100644 docsearch.js
#>  create mode 100644 favicon-16x16.png
#>  create mode 100644 favicon-32x32.png
#>  create mode 100644 favicons/cp/apple-touch-icon-114x114.png
#>  create mode 100644 favicons/cp/apple-touch-icon-120x120.png
#>  create mode 100644 favicons/cp/apple-touch-icon-144x144.png
#>  create mode 100644 favicons/cp/apple-touch-icon-152x152.png
#>  create mode 100644 favicons/cp/apple-touch-icon-57x57.png
#>  create mode 100644 favicons/cp/apple-touch-icon-60x60.png
#>  create mode 100644 favicons/cp/apple-touch-icon-72x72.png
#>  create mode 100644 favicons/cp/apple-touch-icon-76x76.png
#>  create mode 100644 favicons/cp/favicon-128.png
#>  create mode 100644 favicons/cp/favicon-16x16.png
#>  create mode 100644 favicons/cp/favicon-196x196.png
#>  create mode 100644 favicons/cp/favicon-32x32.png
#>  create mode 100644 favicons/cp/favicon-96x96.png
#>  create mode 100644 favicons/cp/favicon.ico
#>  create mode 100644 favicons/cp/mstile-144x144.png
#>  create mode 100644 favicons/cp/mstile-150x150.png
#>  create mode 100644 favicons/cp/mstile-310x150.png
#>  create mode 100644 favicons/cp/mstile-310x310.png
#>  create mode 100644 favicons/cp/mstile-70x70.png
#>  create mode 100644 favicons/dc/apple-touch-icon-114x114.png
#>  create mode 100644 favicons/dc/apple-touch-icon-120x120.png
#>  create mode 100644 favicons/dc/apple-touch-icon-144x144.png
#>  create mode 100644 favicons/dc/apple-touch-icon-152x152.png
#>  create mode 100644 favicons/dc/apple-touch-icon-57x57.png
#>  create mode 100644 favicons/dc/apple-touch-icon-60x60.png
#>  create mode 100644 favicons/dc/apple-touch-icon-72x72.png
#>  create mode 100644 favicons/dc/apple-touch-icon-76x76.png
#>  create mode 100644 favicons/dc/favicon-128.png
#>  create mode 100644 favicons/dc/favicon-16x16.png
#>  create mode 100644 favicons/dc/favicon-196x196.png
#>  create mode 100644 favicons/dc/favicon-32x32.png
#>  create mode 100644 favicons/dc/favicon-96x96.png
#>  create mode 100644 favicons/dc/favicon.ico
#>  create mode 100644 favicons/dc/mstile-144x144.png
#>  create mode 100644 favicons/dc/mstile-150x150.png
#>  create mode 100644 favicons/dc/mstile-310x150.png
#>  create mode 100644 favicons/dc/mstile-310x310.png
#>  create mode 100644 favicons/dc/mstile-70x70.png
#>  create mode 100644 favicons/lc/apple-touch-icon-114x114.png
#>  create mode 100644 favicons/lc/apple-touch-icon-120x120.png
#>  create mode 100644 favicons/lc/apple-touch-icon-144x144.png
#>  create mode 100644 favicons/lc/apple-touch-icon-152x152.png
#>  create mode 100644 favicons/lc/apple-touch-icon-57x57.png
#>  create mode 100644 favicons/lc/apple-touch-icon-60x60.png
#>  create mode 100644 favicons/lc/apple-touch-icon-72x72.png
#>  create mode 100644 favicons/lc/apple-touch-icon-76x76.png
#>  create mode 100644 favicons/lc/favicon-128.png
#>  create mode 100644 favicons/lc/favicon-16x16.png
#>  create mode 100644 favicons/lc/favicon-196x196.png
#>  create mode 100644 favicons/lc/favicon-32x32.png
#>  create mode 100644 favicons/lc/favicon-96x96.png
#>  create mode 100644 favicons/lc/favicon.ico
#>  create mode 100644 favicons/lc/mstile-144x144.png
#>  create mode 100644 favicons/lc/mstile-150x150.png
#>  create mode 100644 favicons/lc/mstile-310x150.png
#>  create mode 100644 favicons/lc/mstile-310x310.png
#>  create mode 100644 favicons/lc/mstile-70x70.png
#>  create mode 100644 favicons/swc/apple-touch-icon-114x114.png
#>  create mode 100644 favicons/swc/apple-touch-icon-120x120.png
#>  create mode 100644 favicons/swc/apple-touch-icon-144x144.png
#>  create mode 100644 favicons/swc/apple-touch-icon-152x152.png
#>  create mode 100644 favicons/swc/apple-touch-icon-57x57.png
#>  create mode 100644 favicons/swc/apple-touch-icon-60x60.png
#>  create mode 100644 favicons/swc/apple-touch-icon-72x72.png
#>  create mode 100644 favicons/swc/apple-touch-icon-76x76.png
#>  create mode 100644 favicons/swc/favicon-128.png
#>  create mode 100644 favicons/swc/favicon-16x16.png
#>  create mode 100644 favicons/swc/favicon-196x196.png
#>  create mode 100644 favicons/swc/favicon-32x32.png
#>  create mode 100644 favicons/swc/favicon-96x96.png
#>  create mode 100644 favicons/swc/favicon.ico
#>  create mode 100644 favicons/swc/mstile-144x144.png
#>  create mode 100644 favicons/swc/mstile-150x150.png
#>  create mode 100644 favicons/swc/mstile-310x150.png
#>  create mode 100644 favicons/swc/mstile-310x310.png
#>  create mode 100644 favicons/swc/mstile-70x70.png
#>  create mode 100644 fig/introduction-rendered-pyramid-1.png
#>  create mode 100644 images.html
#>  create mode 100644 index.html
#>  create mode 100644 instructor-notes.html
#>  create mode 100644 instructor/404.html
#>  create mode 100644 instructor/CODE_OF_CONDUCT.html
#>  create mode 100644 instructor/LICENSE.html
#>  create mode 100644 instructor/aio.html
#>  create mode 100644 instructor/images.html
#>  create mode 100644 instructor/index.html
#>  create mode 100644 instructor/instructor-notes.html
#>  create mode 100644 instructor/introduction.html
#>  create mode 100644 instructor/key-points.html
#>  create mode 100644 instructor/profiles.html
#>  create mode 100644 instructor/reference.html
#>  create mode 100644 introduction.html
#>  create mode 100644 key-points.html
#>  create mode 100644 link.svg
#>  create mode 100644 md5sum.txt
#>  create mode 100644 mstile-150x150.png
#>  create mode 100644 pkgdown.css
#>  create mode 100644 pkgdown.js
#>  create mode 100644 pkgdown.yml
#>  create mode 100644 profiles.html
#>  create mode 100644 reference.html
#>  create mode 100644 renv.lock
#>  create mode 100644 safari-pinned-tab.svg
#>  create mode 100644 site.webmanifest
#>  create mode 100644 sitemap.xml
#> Running git remote -v
#> sandpaper-local	/tmp/Rtmpy58M2t/REMOTE-18762aa7cc19 (fetch)
#> sandpaper-local	/tmp/Rtmpy58M2t/REMOTE-18762aa7cc19 (push)
#> Running git push --force sandpaper-local 'HEAD:gh-pages'
#> To /tmp/Rtmpy58M2t/REMOTE-18762aa7cc19
#>    7b46662..6841aa1  HEAD -> gh-pages
#> ::endgroup::
#> Running git worktree remove --force \
#>   /tmp/Rtmpy58M2t/file18762171f4b9/lesson-example/site/docs
#> Running git worktree remove --force \
#>   /tmp/Rtmpy58M2t/file18762171f4b9/lesson-example/site/built
tok <- Sys.time()
cli::cli_alert_info("Elapsed time: {round(tok - tik, 2)} seconds")
#>  Elapsed time: 11.03 seconds

# reporting -----
# The repository and remote should both have three branches
cli::cli_h2("Local status")
#> 
#> ── Local status ──
#> 
gert::git_branch_list(repo = res)[c('name', 'commit', 'updated')]
#> # A tibble: 6 × 3
#>   name                       commit                  updated            
#>   <chr>                      <chr>                   <dttm>             
#> 1 gh-pages                   6841aa164993176bff2f56… 2024-04-19 13:10:22
#> 2 main                       121aaab1f8ea51501edd2e… 2024-04-19 13:10:11
#> 3 md-outputs                 2d37db032a39b0b7e9855c… 2024-04-19 13:10:15
#> 4 sandpaper-local/gh-pages   6841aa164993176bff2f56… 2024-04-19 13:10:22
#> 5 sandpaper-local/main       121aaab1f8ea51501edd2e… 2024-04-19 13:10:11
#> 6 sandpaper-local/md-outputs 2d37db032a39b0b7e9855c… 2024-04-19 13:10:15

# An indicator this worked: the first episode should be represented as
# different files across the branches:
# - main: Rmd
# - md-outputs: md
# - gh-pages: html
cli::cli_h2("First episode status")
#> ── First episode status ──
#> 
gert::git_stat_files("episodes/introduction.Rmd", repo = rmt)
#> # A tibble: 1 × 5
#>   file             created             modified            commits head 
#> * <chr>            <dttm>              <dttm>                <int> <chr>
#> 1 episodes/introd… 2024-04-19 13:10:11 2024-04-19 13:10:11       1 121a…
cli::cli_h3("rendered markdown")
#> ── rendered markdown 
gert::git_stat_files("introduction.md", repo = rmt, ref = "md-outputs")
#> # A tibble: 1 × 5
#>   file            created             modified            commits head  
#> * <chr>           <dttm>              <dttm>                <int> <chr> 
#> 1 introduction.md 2024-04-19 13:10:15 2024-04-19 13:10:15       1 2d37d…
cli::cli_h3("html file")
#> 
#> ── html file 
gert::git_stat_files("introduction.html", repo = rmt, ref = "gh-pages")
#> # A tibble: 1 × 5
#>   file             created             modified            commits head 
#> * <chr>            <dttm>              <dttm>                <int> <chr>
#> 1 introduction.ht… 2024-04-19 13:10:22 2024-04-19 13:10:22       1 6841…

# CLEAN -------------------------------------------------------------------
tik <- Sys.time()
cli::cli_h1("Clean Up")
#> 
#> ── Clean Up ────────────────────────────────────────────────────────────
snd$remove_local_remote(repo = res)
#>  removing 'sandpaper-local' (/tmp/Rtmpy58M2t/REMOTE-18762aa7cc19)
#> /tmp/Rtmpy58M2t/REMOTE-18762aa7cc19
snd$reset_git_user(res)
# remove the test fixture and report
tryCatch(fs::dir_delete(res), error = function() FALSE)
tok <- Sys.time()
cli::cli_alert_info("Elapsed time: {round(tok - tik, 2)} seconds")
#>  Elapsed time: 0.1 seconds