-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
69 lines (62 loc) · 1.72 KB
/
.gitlab-ci.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
stages:
- publish
- deploy
variables:
# Specifies which version of python to use
PYTHON_VERSION: "3.7"
# This is the relative directory of your python package
PACKAGE_DIR: $CI_PROJECT_NAME
.python:
image: python:${PYTHON_VERSION}
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PYTHONUSERBASE: "$CI_PROJECT_DIR/.cache/user-site"
# Pip's cache doesn't store the python packages
# Instead we use user-site/ as the user base
# See: https://pip.readthedocs.io/en/latest/user_guide/#user-installs
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .cache/pip
- .cache/user-site/
before_script:
- export PATH="$PATH:$PYTHONUSERBASE/bin"
- mkdir -p .cache/user-site/
- python -V
- pip install nbconvert
- pip install requests==2.7.0
pages:
extends: .python
stage: publish
only:
refs:
- master
script:
- cd $CI_PROJECT_DIR
- mkdir public
- |
for FILE in ${CI_PROJECT_DIR}/python/*.ipynb; do
jupyter nbconvert --output-dir=${CI_PROJECT_DIR}/public --to html $FILE;
echo "File $FILE converted"
done
- mv public/TOC.html public/tmp.html
- cat public/tmp.html | sed 's_gitlab.com/flywheel-io/public/flywheel-tutorials/-/blob/master/python_flywheel-io.gitlab.io/public/flywheel-tutorials_g;s/.ipynb/.html/g' > public/index.html
- rm public/tmp.html
- ls public/
artifacts:
paths:
- public
deploy:publish_article:
extends: .python
stage: deploy
only:
refs:
- master
script:
- sleep 3m
- python3 ${CI_PROJECT_DIR}/.script/zd_article_setup.py
artifacts:
paths:
- public