-
Notifications
You must be signed in to change notification settings - Fork 53
56 lines (46 loc) · 1.56 KB
/
publish.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
name: Publish
on:
workflow_dispatch:
push:
branches:
- "main"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
main:
name: "Publish docs.ankidroid.org"
if: github.repository == 'ankidroid/ankidroiddocs'
runs-on: ubuntu-latest
steps:
- name: SSH key setup
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.DOCS_SSH_PRIVATE_KEY }}
- name: SSH server key setup
run: |
ssh-keyscan ankidroid.org >> ~/.ssh/known_hosts
shell: bash
- name: Git Checkout
uses: actions/checkout@v4
- name: Prepare website directory
run: |
mkdir _site
cp -r img _site/
cp icons/* _site/
- name: Install Asciidoctor
run: |
sudo chown -R $USER /var/lib/gems/
sudo chown -R $USER /usr/local/bin
gem install asciidoctor
shell: bash
- name: Render Docs
run: asciidoctor ./*.asc -D _site/
- name: Copy Docs to ankidroid.org
run: scp -r _site/* [email protected]:/usr/share/nginx/html/
shell: bash
- name: Restart nginx web server
# - why? nginx used to fail periodically requiring a restart. But who has access? How to restart?
# This alloww people with publish access a button-push way to force a restart if necessary,
# and the restart is quick enough that doing it on publish is fine.
run: ssh [email protected] /usr/bin/sudo /usr/sbin/service nginx restart