39 lines
1.2 KiB
YAML
39 lines
1.2 KiB
YAML
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 }}"
|
|
|