Skip to content

Commit 924473c

Browse files
committed
TVB-3135. Generate online help.
1 parent 3192c11 commit 924473c

File tree

2 files changed

+33
-15
lines changed

2 files changed

+33
-15
lines changed

.github/workflows/build-docker-image.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ jobs:
3939
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
4040
# password: ${{ secrets.DOCKER_HUB_PASSWORD }}
4141

42-
- name: Login to EBRAINS Docker Registry
43-
uses: docker/login-action@v3
44-
with:
45-
registry: ${{ env.DOCKER_EBRAINS_REGISTRY }}
46-
username: ${{ secrets.EBRAINS_DOCKER_HUB_USERNAME }}
47-
password: ${{ secrets.EBRAINS_DOCKER_HUB_PASSWORD }}
42+
# - name: Login to EBRAINS Docker Registry
43+
# uses: docker/login-action@v3
44+
# with:
45+
# registry: ${{ env.DOCKER_EBRAINS_REGISTRY }}
46+
# username: ${{ secrets.EBRAINS_DOCKER_HUB_USERNAME }}
47+
# password: ${{ secrets.EBRAINS_DOCKER_HUB_PASSWORD }}
4848

4949
- name: Prepare tag for Docker image
5050
# At release time, the tag will be given as input
@@ -57,10 +57,16 @@ jobs:
5757
echo "TAG=${{ github.ref_name }}.alpha" >> $GITHUB_OUTPUT
5858
fi
5959
60-
- name: Prepare TVB online help ZIP
61-
#TODO: generate this
60+
- name: set up Python
61+
uses: actions/setup-python@v4
62+
with:
63+
python-version: "3.13"
64+
65+
- name: Prepare TVB online help
6266
run: |
63-
mkdir tvb_build/docker/step1 && mkdir tvb_build/docker/step1/_help
67+
python3 -m pip install sphinx
68+
python3 build_step1.py ${{ github.ref_name }} True
69+
ls tvb_build/docker
6470
6571
- name: Build Docker image
6672
uses: docker/build-push-action@v6

tvb_build/build_step1.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858

5959
# dest paths
6060
DIST_FOLDER = os.path.join(os.path.dirname(__file__), 'build', 'TVB_Distribution')
61+
DOCKER_FOLDER = os.path.join(os.path.dirname(__file__), 'docker', 'step1')
6162

6263
DATA_INSIDE_FOLDER = os.path.join(DIST_FOLDER, '_tvb_data')
6364

@@ -204,7 +205,7 @@ def ensure_tvb_current_revision(branch=None, token=None):
204205
print("Updating tvb.version content in %s to: %s because %d != %d" % (path, new_text, written_tvb_number, real_version_number))
205206

206207

207-
def build_step1():
208+
def build_step1(only_online_help=False):
208209
# Import only after TVB Revision number has been changed, to get the latest number in generated documentation
209210
from tvb_build.tvb_documentor.doc_generator import DocGenerator
210211

@@ -221,8 +222,16 @@ def build_step1():
221222
# make help HTML, PDF manual and documentation site
222223
print("Starting to populate %s" % DIST_FOLDER)
223224
doc_generator = DocGenerator(TVB_ROOT, DIST_FOLDER)
224-
doc_generator.generate_pdfs()
225225
doc_generator.generate_online_help()
226+
227+
if only_online_help:
228+
if os.path.exists(DOCKER_FOLDER):
229+
shutil.rmtree(DOCKER_FOLDER)
230+
os.makedirs(DOCKER_FOLDER)
231+
shutil.move(DIST_FOLDER, DOCKER_FOLDER)
232+
return
233+
234+
doc_generator.generate_pdfs()
226235
doc_generator.generate_site()
227236

228237
shutil.copy2(LICENSE_PATH, os.path.join(DIST_FOLDER, 'LICENSE_TVB.txt'))
@@ -248,8 +257,11 @@ def build_step1():
248257
branch = sys.argv[1]
249258
if branch.startswith("origin/"):
250259
branch = branch.replace("origin/","")
251-
token = None
260+
# token = None
261+
# if len(sys.argv) > 2:
262+
# token = sys.argv[2]
263+
# ensure_tvb_current_revision(branch, token)
264+
only_online_help = False
252265
if len(sys.argv) > 2:
253-
token = sys.argv[2]
254-
ensure_tvb_current_revision(branch, token)
255-
build_step1()
266+
only_online_help = bool(sys.argv[3])
267+
build_step1(only_online_help)

0 commit comments

Comments
 (0)