forked from tensorly/tensorly
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (54 loc) · 1.9 KB
/
build_doc.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
name: Build documentation
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: "pip"
cache-dependency-path: |
doc/requirements_doc.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install git+https://github.com/tensorly/tensorly-sphinx-theme.git@main
python -m pip install -r doc/requirements_doc.txt
- name: Install package
run: |
python -m pip install -e .
- name: Make doc
run: |
cd doc
python minify.py
make html
cd ..
- name: Push doc to website
if: success() && github.ref == 'refs/heads/main'
run: |
# Add deploy key and clone through ssh
eval "$(ssh-agent -s)"
mkdir ~/.ssh
echo "${{ secrets.DEPLOY_DOC_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -t rsa github.com
echo 'Documentation was successfully built, updating the website.'
# See https://github.community/t/github-actions-bot-email-address/17204/5
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions"
git clone "git@github.com:tensorly/tensorly.github.io.git" doc_folder
echo "-- Updating the content"
cd doc_folder
git rm -r dev/*
mkdir -p dev
echo "Copying to folder"
cp -r ../doc/_build/html/* dev/
echo "Pushing to git"
git add dev
git commit -m "Github action: auto-update."
git push --force origin main