EACompanion/.forgejo/workflows/book.yml
Simon 5de4591f64
All checks were successful
Build and deploy the book / book (pull_request) Successful in 5s
Build and deploy the book / book (push) Successful in 5s
Run CI for feature branches
2026-08-20 11:03:54 +01:00

34 lines
1.1 KiB
YAML

name: Build and deploy the book
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
book:
runs-on: docker
container:
image: eacompanion-bookdown:1
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: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main' }}
env:
DEPLOY_KEY: ${{ secrets.EACOMPANION_DEPLOY_KEY }}
run: |
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 ${{ github.sha }}"