-
Notifications
You must be signed in to change notification settings - Fork 245
66 lines (56 loc) · 2.05 KB
/
docs.yml
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
name: Deploy
on:
push:
branches: [trunk]
jobs:
##############################################################################
# build documentation
##############################################################################
build-doc:
name: Push documentation to website
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: "Check for changes in documentation"
id: check_doc_changes
run: |
if test -z "$(git diff --name-only HEAD~1..HEAD -- doc/)";
then
echo "No changes in doc/"
echo "diff=false" >> $GITHUB_OUTPUT
else
echo "Changes in doc/ detected"
echo "diff=true" >> $GITHUB_OUTPUT
fi
- name: "Setup"
if: success() && steps.check_doc_changes.outputs.diff == 'true'
run: |
sudo apt install -y python3-sphinx
sphinx-build --version
- name: "Build documentation"
if: success() && steps.check_doc_changes.outputs.diff == 'true'
run: |
cd doc
make html SPHINXOPTS="-W -j auto"
- name: "Create a tarball of the documentation"
if: success() && steps.check_doc_changes.outputs.diff == 'true'
run: |
cd doc/build
mv html doc
tar -czvf doc.tar.gz doc
- name: "Setup SSH key"
if: success() && steps.check_doc_changes.outputs.diff == 'true'
uses: shimataro/[email protected]
with:
key: ${{ secrets.SSH_KEY }}
name: id_ed25519
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- name: "Push documentation to server"
if: success() && steps.check_doc_changes.outputs.diff == 'true'
run: |
cd doc/build
ssh -t [email protected] 'mkdir ~/tmp'
scp doc.tar.gz [email protected]:~/tmp
ssh -t [email protected] 'cd ~/tmp && tar -xf doc.tar.gz && rm -rf ~/apps/flintlib_org/doc && mv doc ~/apps/flintlib_org && cd ~ && rm -rf ~/tmp'