Skip to content

Build docs in GitHub Actions #7

Build docs in GitHub Actions

Build docs in GitHub Actions #7

Workflow file for this run

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: πŸ“¦ Install decryptor
run: sudo apt install -y age
- id: decrypt
name: πŸ”“ Decrypt deployment key
run: |
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.output.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/ 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