-
Notifications
You must be signed in to change notification settings - Fork 5.7k
96 lines (86 loc) · 2.83 KB
/
publish-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
run-name: Publish ${{ inputs.version }} docs
on:
workflow_call:
inputs:
version:
description: 'Version of the docs'
required: false
default: 'dev'
type: string
package-dependencies:
description: 'Apt package dependencies'
required: false
default: ''
type: string
repo-name:
description: 'Repo display name in the URL'
required: false
default: ${{ github.event.repository.name }}
type: string
docs-repo:
description: 'Repo to hold the docs'
required: false
default: ivy-llc/docs
type: string
permissions:
contents: write
jobs:
publish-docs:
runs-on: ubuntu-latest
name: Publish ${{ inputs.version }} docs
steps:
- name: Checkout 🛎️ ${{ inputs.repo-name }}
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Checkout 🛎️ Doc-builder
uses: actions/checkout@v4
with:
repository: ivy-llc/doc-builder
path: .doc-builder
- name: Install apt dependencies
if: inputs.package-dependencies != ''
run: |
sudo apt-get update
sudo apt-get install -y ${{ inputs.package-dependencies }}
- name: Setup Python
uses: actions/setup-python@v4
id: setup-python
with:
python-version: '3.10'
- name: Get cache week key
id: get-cache-week-key
run: |
echo "week-key=$(date +'%Y-%V')" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
id: cache
with:
path: ./.venv
key: ${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-pip-${{ steps.get-cache-week-key.outputs.week-key }}
restore-keys: |
${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-pip-
- name: Create virtual environment
if: steps.cache.outputs.cache-hit != 'true'
run: |
python -m venv .venv
- name: Build docs
run: |
source .venv/bin/activate
pip install --upgrade pip
pip install wheel setuptools
cd .doc-builder
export IVY_VERSION=${{ inputs.version }}
./make_docs_without_docker.sh ..
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
folder: docs/build
target-folder: "${{ inputs.version != 'dev' && format('{0}/', inputs.version) || '' }}${{ inputs.repo-name }}"
ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }}
branch: main
git-config-name: ivy-dev-bot
git-config-email: [email protected]
repository-name: ${{ inputs.docs-repo }}
clean: true