aboutsummaryrefslogtreecommitdiff
path: root/.gitea/workflows/docs-deploy.yml
blob: b4788e2e98135f68d7f940595debfbf36dc5d7b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Docs Deploy

on:
  push:
    branches:
      - master

jobs:
  deploy-docs:
    name: Build and Deploy MkDocs
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v6

      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version: "3.12"

      - name: Install docs dependencies
        run: pip install -r requirements.txt

      - name: Build MkDocs site
        run: mkdocs build

      - name: Install rsync
        run: |
          sudo apt-get update
          sudo apt-get install -y rsync openssh-client

      - name: Prepare SSH key
        env:
          SSH_KEY_B64: ${{ secrets.ROOT_CI_KEY_B64 }}
        run: |
          umask 077
          mkdir -p ~/.ssh
          printf '%s' "$SSH_KEY_B64" | base64 -d > ~/.ssh/id_root_ci
          chmod 600 ~/.ssh/id_root_ci

      - name: Deploy via rsync
        env:
          DEPLOY_HOST: ${{ secrets.FPARKAN_DEPLOY_HOST }}
          DEPLOY_PORT: ${{ secrets.FPARKAN_DEPLOY_PORT }}
        run: |
          rsync -rlz --delete \
            -e "ssh -p ${DEPLOY_PORT} -i ~/.ssh/id_root_ci -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new" \
            site/ "gitea-runner@${DEPLOY_HOST}:./"