-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (60 loc) · 1.86 KB
/
Copy pathdocs.yml
File metadata and controls
71 lines (60 loc) · 1.86 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Publish Docs
on:
workflow_dispatch:
pull_request:
push:
tags: ["v*"]
permissions:
contents: read
jobs:
build_docs:
runs-on: ubuntu-latest
steps:
- name: Checkout psi-data-utils
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
cache: pip
- name: Install docs dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[docs]"
- name: Build docs
run: |
sphinx-build docs/source docs/_build/html
- name: Upload docs artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/_build/html/
retention-days: 7
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.DOCS_SSH_KEY }}
known_hosts: "placeholder"
- name: Add known_hosts from target
env:
SSH_HOST: ${{ secrets.DOCS_SSH_HOST }}
SSH_PORT: ${{ secrets.DOCS_SSH_PORT }}
run: |
mkdir -p ~/.ssh
ssh-keyscan -p "${SSH_PORT:-22}" -H "${SSH_HOST}" >> ~/.ssh/known_hosts
- name: Rsync to server
env:
SSH_HOST: ${{ secrets.DOCS_SSH_HOST }}
SSH_USER: ${{ secrets.DOCS_SSH_USER }}
SSH_PORT: ${{ secrets.DOCS_SSH_PORT }}
REMOTE_DIR: ${{ secrets.DOCS_SSH_PATH }}
run: |
ssh -p "${SSH_PORT:-22}" "${SSH_USER}@${SSH_HOST}" "mkdir -p '${REMOTE_DIR}'"
rsync -rlvz \
--delete \
--omit-dir-times --no-times \
--no-perms --no-owner --no-group \
--chmod=D755,F644 \
-e "ssh -p ${SSH_PORT:-22}" \
docs/_build/html/ "${SSH_USER}@${SSH_HOST}:${REMOTE_DIR}/"