-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
96 lines (90 loc) · 2.5 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
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
image: python:3.10
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.pip-cache"
DOCS_IMAGE: $CI_REGISTRY_IMAGE/docs
cache:
paths:
- .pip-cache/
stages:
- build_docs
- build_docker
# - publish
build_docs:
stage: build_docs
only:
- tags
script:
- cd openlch
- pip install --upgrade pip
- pip install pdoc
- pip install -r requirements.txt
- cd ..
- pdoc openlch -o docs -d google
artifacts:
paths:
- docs/
build_docker:
stage: build_docker
image: docker:latest
services:
- docker:dind
only:
- tags
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin
script:
- |
cat <<EOF > nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '\$remote_addr - \$remote_user [\$time_local] "\$request" '
'\$status \$body_bytes_sent "\$http_referer" '
'"\$http_user_agent" "\$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location /python {
root /usr/share/nginx/html;
index index.html index.htm;
try_files \$uri \$uri/ /python/index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
EOF
- |
cat <<EOF > Dockerfile
FROM nginx:alpine
COPY docs /usr/share/nginx/html/python
COPY nginx.conf /etc/nginx/nginx.conf
EOF
- docker build --pull -t $DOCS_IMAGE:$CI_COMMIT_TAG -t $DOCS_IMAGE:latest .
- docker push $DOCS_IMAGE:$CI_COMMIT_TAG
- docker push $DOCS_IMAGE:latest
# publish:
# stage: publish
# only:
# - tags
# script:
# - pip install --upgrade pip
# - pip install build wheel
# - python -m build --sdist --wheel --outdir dist/ .
# - pip install twine
# - TWINE_PASSWORD=${PYPI_API_TOKEN} TWINE_USERNAME=__token__ python -m twine upload dist/*
# artifacts:
# paths:
# - dist/*