name: Deploy Lakehouse Docs on: push: branches: - main - master jobs: build-and-deploy: runs-on: ubuntu-latest container: # Use the rocker/verse image as it contains R, pandoc, quarto, and many tidyverse dependencies image: rocker/verse:4.4 steps: - name: Checkout repository uses: actions/checkout@v3 - name: Install system dependencies # Install system dependencies required for R packages (xml2, curl, graphics libraries) + rsync/ssh run: | apt-get update -y apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev libglpk-dev libfontconfig1-dev libfreetype6-dev libharfbuzz-dev libfribidi-dev libpng-dev libjpeg-dev libtiff-dev libzstd-dev cmake rsync openssh-client - name: Install R package dependencies # First install 'renv' or 'remotes', then install project dependencies # Using remotes here as it's typically faster for CI if renv cache isn't available run: | Rscript -e "install.packages('remotes')" Rscript -e "remotes::install_deps(dependencies = TRUE)" - name: Run Build Script # This executes deploy.R which runs styler, devtools::document, targets::tar_make, and pkgdown::build_site # Note: If tar_make() interacts with MinIO, you MUST provide the BAF_* secrets in Gitea repository settings. env: BAF_KEY: ${{ secrets.BAF_KEY }} BAF_SECRET: ${{ secrets.BAF_SECRET }} BAF_ENDPOINT: ${{ secrets.BAF_ENDPOINT }} run: | Rscript deploy.R - name: Deploy via Rsync # Rsync the generated docs/ folder to the host machine. # This requires setting DEPLOY_SSH_KEY, DEPLOY_SERVER_USER, and DEPLOY_SERVER_IP in Gitea Secrets. env: SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SSH_KEY }} SERVER_IP: ${{ secrets.DEPLOY_SERVER_IP }} SERVER_USER: ${{ secrets.DEPLOY_SERVER_USER }} TARGET_DIR: /data/projects/bank-fraud-baf-lakehouse/docs/ run: | # Setup SSH key mkdir -p ~/.ssh echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa # Add host to known_hosts to prevent interactive prompt ssh-keyscan -H $SERVER_IP >> ~/.ssh/known_hosts # Sync the docs/ directory directly into the Caddy webroot rsync -avz --delete docs/ ${SERVER_USER}@${SERVER_IP}:${TARGET_DIR}