diff --git a/.forgejo/workflows/book.yml b/.forgejo/workflows/book.yml
new file mode 100644
index 0000000..28e5796
--- /dev/null
+++ b/.forgejo/workflows/book.yml
@@ -0,0 +1,39 @@
+name: Build and deploy the book
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+jobs:
+ book:
+ runs-on: docker
+ container:
+ image: rocker/verse:4.4.3
+ steps:
+ - name: Check out the repository
+ uses: actions/checkout@v4
+
+ - name: Render Bookdown
+ run: |
+ Rscript -e 'bookdown::render_book("index.Rmd", output_format = "bookdown::gitbook", output_dir = "_book", clean = TRUE)'
+ test -f _book/index.html
+
+ - name: Deploy successful main build
+ if: forgejo.event_name == 'push' && forgejo.ref == 'refs/heads/main'
+ env:
+ DEPLOY_KEY: ${{ secrets.EACOMPANION_DEPLOY_KEY }}
+ run: |
+ apt-get update
+ apt-get install -y --no-install-recommends openssh-client
+ install -d -m 0700 "$HOME/.ssh"
+ printf '%s\n' "$DEPLOY_KEY" > "$HOME/.ssh/id_ed25519"
+ chmod 0600 "$HOME/.ssh/id_ed25519"
+ printf '%s\n' '[81.187.28.216]:12 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDKyA1+5/gU2P27AuDbk2SRNFeuumRP9pEicZc7zu51n' > "$HOME/.ssh/known_hosts"
+ tar -C _book -czf - . | ssh -p 12 eacompanion@81.187.28.216 "deploy ${{ forgejo.sha }}"
+
diff --git a/_output.yml b/_output.yml
new file mode 100644
index 0000000..c6b9537
--- /dev/null
+++ b/_output.yml
@@ -0,0 +1,26 @@
+bookdown::gitbook:
+ css: book.css
+ split_by: section
+ config:
+ toc:
+ collapse: section
+ scroll_highlight: true
+ before: |
+
+ EA Companion
+ Evolutionary Archaeology
+
+ toolbar:
+ position: fixed
+ search:
+ engine: fuse
+ fontsettings:
+ theme: white
+ family: sans
+ size: 2
+ sharing:
+ github: false
+ facebook: false
+ twitter: false
+ all: false
+
diff --git a/book.css b/book.css
new file mode 100644
index 0000000..92525de
--- /dev/null
+++ b/book.css
@@ -0,0 +1,198 @@
+@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,750&family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&display=swap");
+
+:root {
+ --paper: #f7f1e5;
+ --paper-deep: #ece1cf;
+ --ink: #202c2a;
+ --muted: #66706b;
+ --teal: #0d6661;
+ --teal-dark: #084b48;
+ --terracotta: #bd573b;
+ --ochre: #d6a53a;
+ --line: #d8cbb8;
+}
+
+body,
+.book.font-family-1 {
+ color: var(--ink);
+ font-family: "IBM Plex Sans", sans-serif;
+ background:
+ radial-gradient(circle at 85% 8%, rgba(214, 165, 58, 0.12), transparent 24rem),
+ var(--paper);
+}
+
+.book .book-summary {
+ background:
+ linear-gradient(160deg, rgba(13, 102, 97, 0.98), rgba(8, 75, 72, 0.99)),
+ var(--teal-dark);
+ border-right: 0;
+ color: #f8f2e7;
+}
+
+.book .book-summary ul.summary {
+ padding: 0 0 2rem;
+}
+
+.book .book-summary ul.summary li a,
+.book .book-summary ul.summary li span {
+ color: rgba(255, 255, 255, 0.78);
+ padding: 0.62rem 1.25rem;
+}
+
+.book .book-summary ul.summary li a:hover {
+ color: #fff;
+ background: rgba(255, 255, 255, 0.08);
+}
+
+.book .book-summary ul.summary li.active > a {
+ color: #fff;
+ background: rgba(255, 255, 255, 0.12);
+ border-left: 4px solid var(--ochre);
+ font-weight: 600;
+}
+
+.book .book-summary ul.summary li.divider {
+ background: rgba(255, 255, 255, 0.16);
+}
+
+.ea-brand {
+ margin: 0 0 1rem !important;
+ padding: 2.25rem 1.25rem 1.6rem !important;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.18);
+ background: rgba(0, 0, 0, 0.08);
+}
+
+.ea-brand a {
+ padding: 0 !important;
+ color: #fff !important;
+ font-family: "Fraunces", serif;
+ font-size: 1.65rem;
+ font-weight: 750;
+ letter-spacing: -0.025em;
+}
+
+.ea-brand span {
+ display: block;
+ padding: 0.35rem 0 0 !important;
+ color: rgba(255, 255, 255, 0.62) !important;
+ font-size: 0.7rem;
+ font-weight: 600;
+ letter-spacing: 0.14em;
+ text-transform: uppercase;
+}
+
+.book .book-body,
+.book .book-body .page-wrapper .page-inner section.normal {
+ background: transparent;
+}
+
+.book .book-body .page-wrapper .page-inner {
+ max-width: 900px;
+ padding: 3rem 4rem 6rem;
+}
+
+.book .book-body .page-wrapper .page-inner section.normal {
+ color: var(--ink);
+ font-size: 1.02rem;
+ line-height: 1.75;
+}
+
+.book .book-body .page-wrapper .page-inner section.normal h1,
+.book .book-body .page-wrapper .page-inner section.normal h2,
+.book .book-body .page-wrapper .page-inner section.normal h3 {
+ color: var(--teal-dark);
+ font-family: "Fraunces", serif;
+ font-weight: 700;
+ letter-spacing: -0.025em;
+}
+
+.book .book-body .page-wrapper .page-inner section.normal h1 {
+ position: relative;
+ margin: 0 0 2.5rem;
+ padding: 0 0 1rem;
+ font-size: clamp(2.5rem, 7vw, 4.6rem);
+ line-height: 1.02;
+}
+
+.book .book-body .page-wrapper .page-inner section.normal h1::after {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ width: 5rem;
+ height: 5px;
+ content: "";
+ background: linear-gradient(90deg, var(--terracotta) 0 60%, var(--ochre) 60%);
+}
+
+.book .book-body .page-wrapper .page-inner section.normal h2 {
+ margin-top: 2.6rem;
+ font-size: 2rem;
+}
+
+.book .book-body .page-wrapper .page-inner section.normal a {
+ color: var(--teal);
+ text-decoration-color: rgba(189, 87, 59, 0.55);
+ text-decoration-thickness: 2px;
+ text-underline-offset: 0.16em;
+}
+
+.book .book-body .page-wrapper .page-inner section.normal blockquote {
+ margin: 2rem 0;
+ padding: 1rem 1.5rem;
+ color: var(--teal-dark);
+ background: rgba(13, 102, 97, 0.07);
+ border-left: 5px solid var(--terracotta);
+}
+
+.book .book-body .page-wrapper .page-inner section.normal code,
+.book .book-body .page-wrapper .page-inner section.normal pre {
+ font-family: "IBM Plex Mono", monospace;
+}
+
+.book .book-body .page-wrapper .page-inner section.normal pre {
+ padding: 1.25rem;
+ background: #192523;
+ border: 0;
+ border-radius: 3px;
+}
+
+.book .book-body .page-wrapper .page-inner section.normal pre code {
+ color: #e9e2d6;
+}
+
+.book .book-body .page-wrapper .page-inner section.normal table {
+ display: table;
+ width: 100%;
+ border: 1px solid var(--line);
+}
+
+.book .book-body .page-wrapper .page-inner section.normal table th {
+ color: #fff;
+ background: var(--teal);
+}
+
+.book .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) {
+ background: rgba(216, 203, 184, 0.28);
+}
+
+.book .book-body .page-wrapper .page-inner section.normal img {
+ border-radius: 3px;
+ box-shadow: 0 1rem 2.5rem rgba(32, 44, 42, 0.12);
+}
+
+.book .book-header.fixed {
+ background: rgba(247, 241, 229, 0.92);
+ border-bottom: 1px solid rgba(216, 203, 184, 0.7);
+ backdrop-filter: blur(10px);
+}
+
+@media (max-width: 700px) {
+ .book .book-body .page-wrapper .page-inner {
+ padding: 2rem 1.35rem 4rem;
+ }
+
+ .book .book-body .page-wrapper .page-inner section.normal h1 {
+ font-size: 2.6rem;
+ }
+}
+
diff --git a/deploy/receive-eacompanion-release b/deploy/receive-eacompanion-release
new file mode 100644
index 0000000..bb9da8c
--- /dev/null
+++ b/deploy/receive-eacompanion-release
@@ -0,0 +1,56 @@
+#!/bin/bash
+set -euo pipefail
+umask 022
+
+releases_dir="/var/www/html/randomdrift/.EACompanion-releases"
+publish_dir="/var/www/html/randomdrift/.EACompanion-publish"
+public_link="${publish_dir}/current"
+original_command="${SSH_ORIGINAL_COMMAND:-}"
+
+if [[ ! "${original_command}" =~ ^deploy\ ([0-9a-f]{40})$ ]]; then
+ echo "Invalid deployment command" >&2
+ exit 1
+fi
+
+revision="${BASH_REMATCH[1]}"
+release_dir="${releases_dir}/${revision}"
+
+exec 9>/var/lib/eacompanion/deploy.lock
+flock -n 9 || exit 1
+
+if [[ ! -f "${release_dir}/index.html" ]]; then
+ archive_path="$(mktemp /var/lib/eacompanion/artifact.XXXXXX.tar.gz)"
+ staging_dir="$(mktemp -d "${releases_dir}/.incoming.XXXXXX")"
+
+ cleanup() {
+ case "${archive_path}" in
+ /var/lib/eacompanion/artifact.*.tar.gz) rm -f -- "${archive_path}" ;;
+ esac
+ case "${staging_dir}" in
+ "${releases_dir}"/.incoming.*) rm -rf -- "${staging_dir}" ;;
+ esac
+ }
+ trap cleanup EXIT
+
+ cat > "${archive_path}"
+ tar --extract --gzip --file "${archive_path}" --directory "${staging_dir}" \
+ --no-same-owner --no-same-permissions
+
+ if [[ ! -f "${staging_dir}/index.html" ]]; then
+ echo "Artifact does not contain index.html" >&2
+ exit 1
+ fi
+ if find "${staging_dir}" -type l -print -quit | grep -q .; then
+ echo "Artifact contains a symbolic link" >&2
+ exit 1
+ fi
+
+ chmod -R a+rX,u+w "${staging_dir}"
+ mv "${staging_dir}" "${release_dir}"
+ rm -f -- "${archive_path}"
+ trap - EXIT
+fi
+
+temporary_link="${public_link}.new"
+ln -sfn "${release_dir}" "${temporary_link}"
+mv -Tf "${temporary_link}" "${public_link}"
diff --git a/index.Rmd b/index.Rmd
index 9ece832..708899f 100644
--- a/index.Rmd
+++ b/index.Rmd
@@ -1,18 +1,26 @@
---
title: "EA Companion"
-author: "CE Book Team"
+author: "Mike O'Brien, Robert Lyman, Simon Carrignon, Alfredo Cortell-Nicolau"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
-output:
- bookdown::gitbook:
- split_by: section
---
-# EA Companion
+# Intro
-This is the front page for the Bookdown project.
+This is the front page for the Online Companion to Evolutionary Archaeology revised second edition.
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
+We will here define a few object and variable that we will be used throught the project
+Setup colors for the rest of the book:
+
+```{r}
+population_colour <- "#333333"
+random_colour <- "#0072B2"
+biased_colour <- "#D55E00"
+conformity_colour <- "#009E73"
+network_colour <- "#CC79A7"
+```
+