forked from opencast/opencast
-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (97 loc) · 3.19 KB
/
deploy-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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Deploy documentation
on:
push:
branches:
- 'r/*'
- 'develop'
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy-documentation:
if: github.repository_owner == 'opencast'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: set up python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: install dependencies
working-directory: docs/guides/
run: |
pip install -q -r requirements.txt
- name: build admin docs
working-directory: docs/guides/admin/
run: |
python -m mkdocs build
- name: build developer docs
working-directory: docs/guides/developer/
run: |
python -m mkdocs build
- name: build landing page
if: github.ref == 'refs/heads/develop'
working-directory: docs/guides/.infrastructure/
run: |
./generate-versions
- name: landing page dependencies
if: github.ref == 'refs/heads/develop'
working-directory: docs/guides/.infrastructure/
run: |
./prep-dependencies
- name: prepare git
run: |
git config --global user.name "Opencast Docs Bot"
git config --global user.email "[email protected]"
- name: prepare github ssh key
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY_DOCS }}
run: |
install -dm 700 ~/.ssh/
echo "${DEPLOY_KEY}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: clone repository
run: |
git clone "[email protected]:opencast/docs.opencast.org.git" docs.opencast.org
cd docs.opencast.org
git checkout gh-pages
- name: remove old deployment
working-directory: docs.opencast.org/
run: |
set -x
echo "${GITHUB_REF#refs/heads/}"
if [ -d "${GITHUB_REF#refs/heads/}" ]; then
git rm -r "${GITHUB_REF#refs/heads/}"
fi
- name: remove old landing page dependencies
if: github.ref == 'refs/heads/develop'
working-directory: docs.opencast.org/
run: |
git rm -r js/ || true
- name: store landing page
if: github.ref == 'refs/heads/develop'
run: |
mv -v docs/guides/.infrastructure/*.html docs.opencast.org/
mv -v docs/guides/.infrastructure/*.js docs.opencast.org/
mv -v docs/guides/.infrastructure/js/ docs.opencast.org/
- name: store build
run: |
mkdir -p docs.opencast.org/"${GITHUB_REF#refs/heads/}"
mv -v docs/guides/admin/site docs.opencast.org/"${GITHUB_REF#refs/heads/}/admin"
mv -v docs/guides/developer/site docs.opencast.org/"${GITHUB_REF#refs/heads/}/developer"
git log -n1 > docs.opencast.org/"${GITHUB_REF#refs/heads/}/commit"
- name: commit new version
working-directory: docs.opencast.org/
run: |
git add .
git commit -m "Build of ${GITHUB_REF#refs/heads/} from $(date)"
- name: push updates
working-directory: docs.opencast.org/
run: |
set -e
if ! git push origin gh-pages; then
git fetch origin
git rebase origin/gh-pages
git push origin gh-pages
fi