# GitHub Actions workflow
# to build `deltachat_ffi` crate documentation
# and upload it to <https://cffi.delta.chat/>

name: Build & Deploy Documentation on cffi.delta.chat

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
          show-progress: false
      - name: Build the documentation with cargo
        run: |
          cargo doc --package deltachat_ffi --no-deps
      - name: Upload to cffi.delta.chat
        run: |
          mkdir -p "$HOME/.ssh"
          echo "${{ secrets.KEY }}" > "$HOME/.ssh/key"
          chmod 600 "$HOME/.ssh/key"
          rsync -avzh -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no" $GITHUB_WORKSPACE/target/doc/ "${{ secrets.USERNAME }}@delta.chat:/var/www/html/cffi/"
