-
Notifications
You must be signed in to change notification settings - Fork 40
119 lines (117 loc) · 3.83 KB
/
build_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
116
117
118
119
name: Build Documentation
# Build documentation on:
# - pushes to master and uploads to latest folder
# - Released and uploads to folder that matches release tag
on:
push:
branches:
- master
release:
types:
- created
jobs:
cpp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Apt update
shell: bash
run: sudo apt update
- name: Install doxygen
shell: bash
run: sudo apt install -y doxygen
- name: Build docs
run: |
cd doc/cpp/
doxygen
- name: Upload built docs
uses: actions/upload-artifact@v4
with:
name: cxx_docs
path: doc/cpp/html/
python:
container:
image: vowpalwabbit/rl-manylinux-2_28-build:latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Clone submodules
shell: bash
run: git submodule update --init --recursive
- name: Install package
shell: bash
run: |
/opt/python/cp38-cp38/bin/python setup.py install
- name: Build docs
run: |
/opt/python/cp38-cp38/bin/pip install sphinx
cd bindings/python/docs
make html SPHINXBUILD=/opt/python/cp38-cp38/bin/sphinx-build
- name: Upload built docs
uses: actions/upload-artifact@v4
with:
name: python_docs
path: bindings/python/docs/build/
upload:
needs: [cpp, python]
runs-on: ubuntu-latest
# The upload step should only be run on the main repository.
if: github.repository == 'VowpalWabbit/reinforcement_learning'
steps:
- name: Set folder name to latest if push
if: github.event_name == 'push'
run: echo "FOLDER_NAME=latest" >> $GITHUB_ENV
- name: Set folder name to version if release
if: github.event_name == 'release'
run: echo "FOLDER_NAME=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV
- name: Download c++ Docs
uses: actions/download-artifact@v4
with:
name: cxx_docs
- name: Download Python Docs
uses: actions/download-artifact@v4
with:
name: python_docs
- uses: actions/checkout@v1
with:
repository: VowpalWabbit/docs
ref: master
# For some reason, path is relative to the directory above GITHUB_WORKSPACE
# To ensure the rest of the script makes sense, we need to place this under reinforcement_learning
path: reinforcement_learning/docs
submodules: recursive
- name: Copy c++ Docs
shell: bash
run: |
rm -rf docs/reinforcement_learning/cpp/$FOLDER_NAME/
mkdir -p docs/reinforcement_learning/cpp/$FOLDER_NAME/
cp -r cxx_docs/* docs/reinforcement_learning/cpp/$FOLDER_NAME/
- name: Copy Python Docs
shell: bash
run: |
rm -rf docs/reinforcement_learning/python/$FOLDER_NAME/
mkdir -p docs/reinforcement_learning/python/$FOLDER_NAME/
cp -r python_docs/html/* docs/reinforcement_learning/python/$FOLDER_NAME/
- name: Checkout master
shell: bash
run: |
cd docs
git checkout master
- name: Commit changes
shell: bash
run: |
cd docs
git add --all
git config --local user.email "[email protected]"
git config --local user.name "WoboWabbit"
git commit -m "Update documentation for commit: VowpalWabbit/reinforcement_learning@${{ github.sha }}" || echo "Nothing to update"
- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: VowpalWabbit/docs
directory: docs
github_token: ${{ secrets.automation_github_token }}