-
Notifications
You must be signed in to change notification settings - Fork 61
92 lines (92 loc) · 2.67 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
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
name: Documentation
'on':
push:
branches:
- main
pull_request: {}
defaults:
run:
shell: bash -el {0}
concurrency:
group: doc-${{github.ref}}
cancel-in-progress: true
jobs:
build:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: 🛒 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- id: setup-env
name: 📦 Set up Conda environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: docs/environment.yml
environment-name: lkpy
init-shell: bash
- id: install
name: 🍱 Install LensKit packages
run: |
pip install --no-deps -e lenskit -e lenskit-funksvd -e lenskit-implicit
- id: docs
name: 📚 Build documentation site
run: |
just docs
- name: 📤 Package documentation site
uses: actions/upload-artifact@v4
with:
name: lenskit-docs
path: build/doc
publish:
name: Publish documentation
runs-on: ubuntu-latest
needs:
- build
environment: docs
steps:
- name: 🛒 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📦 Install decryptor
run: sudo apt install -y age
- id: decrypt
name: 🔓 Decrypt deployment key
run: |
if [ -z "$AGE_DECRYPT" ]; then
echo ::error::Age decryption key not available
exit 1
fi
tmpdir=$(mktemp -d lksite.XXXXXX)
echo "$AGE_DECRYPT" >$tmpdir/decrypt-identity
echo 'deploy-key<<EOK' >$tmpdir/out
age -d -i $tmpdir/decrypt-identity etc/doc-deploy-key.asc >>$tmpdir/out
echo 'EOK' >>$tmpdir/out
cat $tmpdir/out >>$GITHUB_OUTPUT
rm -rf $tmpdir
env:
AGE_DECRYPT: ${{ secrets.DOC_DEPLOY_DECRYPT_KEY }}
- name: Check out doc site
uses: actions/checkout@v4
with:
repository: lenskit/lenskit-docs
ssh-key: ${{steps.decrypt.outputs.decrypt-identity}}
path: doc-site
ref: latest
- name: 📥 Fetch documentation package
uses: actions/download-artifact@v4
with:
name: lenskit-docs
path: build/doc
- name: 🛻 Copy documentation content
run: |
rsync -av --delete --exclude=.git/ --exclude=.buildinfo --exclude=.doctrees \
build/doc/ doc-site/
cd doc-site
git config user.name "LensKit Doc Bot"
git config user.email "[email protected]"
git add .
git commit -m 'rebuild documentation'
git push