mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-24 02:49:07 +01:00
Compare commits
3 commits
d9254a3be7
...
e77a96066d
Author | SHA1 | Date | |
---|---|---|---|
|
e77a96066d | ||
|
c0e388f09b | ||
|
cfa2ff1e6d |
6 changed files with 154 additions and 19 deletions
113
.gitlab-ci.yml
113
.gitlab-ci.yml
|
@ -3,11 +3,15 @@ stages:
|
||||||
- build
|
- build
|
||||||
- publish
|
- publish
|
||||||
|
|
||||||
|
variables:
|
||||||
|
DOC_BRANCH: doc
|
||||||
|
DOC_REMOTE: https://gitlab-ci-token:${ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git
|
||||||
|
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
||||||
|
|
||||||
tests:bullseye:
|
tests:bullseye:
|
||||||
image:
|
image:
|
||||||
name: brenard/ldapsaisie:bullseye
|
name: brenard/ldapsaisie:bullseye
|
||||||
entrypoint: [""]
|
entrypoint: [""]
|
||||||
|
|
||||||
stage: tests
|
stage: tests
|
||||||
rules:
|
rules:
|
||||||
- changes:
|
- changes:
|
||||||
|
@ -33,7 +37,6 @@ tests:buster:
|
||||||
image:
|
image:
|
||||||
name: brenard/ldapsaisie:buster
|
name: brenard/ldapsaisie:buster
|
||||||
entrypoint: [""]
|
entrypoint: [""]
|
||||||
|
|
||||||
stage: tests
|
stage: tests
|
||||||
rules:
|
rules:
|
||||||
- changes:
|
- changes:
|
||||||
|
@ -89,8 +92,14 @@ tests:jessie:
|
||||||
build:debian-sid:
|
build:debian-sid:
|
||||||
image: brenard/debian-python-deb:debian11
|
image: brenard/debian-python-deb:debian11
|
||||||
stage: build
|
stage: build
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- .cache/pip
|
||||||
|
only:
|
||||||
|
- master
|
||||||
script:
|
script:
|
||||||
- ./build-deb.sh --install-build-deps --sid
|
- ./build-deb.sh --install-build-deps --sid
|
||||||
|
- rm -fr dist/ldapsaisie-*
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- dist/*
|
- dist/*
|
||||||
|
@ -98,23 +107,42 @@ build:debian-sid:
|
||||||
build:snapshot:
|
build:snapshot:
|
||||||
stage: build
|
stage: build
|
||||||
image: alpine
|
image: alpine
|
||||||
|
only:
|
||||||
|
- master
|
||||||
script:
|
script:
|
||||||
- tar -czf ldapsaisie-snapshot.tar.gz --exclude=ldapsaisie-snapshot.tar.gz ./
|
- tar -czf ldapsaisie-snapshot.tar.gz --exclude=ldapsaisie-snapshot.tar.gz ./
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- ldapsaisie-snapshot.tar.gz
|
- ldapsaisie-snapshot.tar.gz
|
||||||
|
|
||||||
build:doc:
|
build:doc:html:
|
||||||
stage: build
|
stage: build
|
||||||
image: python:alpine
|
image: python:alpine
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- .cache/pip
|
||||||
|
- doc/venv
|
||||||
|
only:
|
||||||
|
- master
|
||||||
before_script:
|
before_script:
|
||||||
- apk add make
|
- apk add make git
|
||||||
script:
|
- git config user.name $GITLAB_USER_NAME
|
||||||
|
- git config user.email $GITLAB_USER_EMAIL
|
||||||
|
- VERSION=`git describe --tags`
|
||||||
- cd doc
|
- cd doc
|
||||||
- make public_html LdapSaisie.html
|
- git fetch origin $DOC_BRANCH
|
||||||
|
- git rev-parse --verify $DOC_BRANCH && git branch -D $DOC_BRANCH || echo "No existing local git $DOC_BRANCH branch"
|
||||||
|
- git checkout -b $DOC_BRANCH origin/$DOC_BRANCH
|
||||||
|
- git checkout $CI_COMMIT_SHA
|
||||||
|
- make clean && make venv
|
||||||
|
script:
|
||||||
|
- make LdapSaisie.html
|
||||||
|
- test -n "$CI_COMMIT_TAG" && DOC_TAG=stable || DOC_TAG=dev
|
||||||
|
- source venv/bin/activate # We must have to activate the venv to use mike (direct call not supported)
|
||||||
|
- mike deploy --branch $DOC_BRANCH --remote $DOC_REMOTE --push --update-aliases $VERSION $DOC_TAG
|
||||||
|
- mike set-default --branch $DOC_BRANCH --remote $DOC_REMOTE --push $DOC_TAG
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- doc/public_html/
|
|
||||||
- doc/LdapSaisie.html
|
- doc/LdapSaisie.html
|
||||||
|
|
||||||
build:doc:pdf:
|
build:doc:pdf:
|
||||||
|
@ -122,10 +150,13 @@ build:doc:pdf:
|
||||||
image:
|
image:
|
||||||
name: pink33n/html-to-pdf
|
name: pink33n/html-to-pdf
|
||||||
entrypoint: ["/bin/sh", "-c"]
|
entrypoint: ["/bin/sh", "-c"]
|
||||||
|
only:
|
||||||
|
- master
|
||||||
needs:
|
needs:
|
||||||
- build:doc
|
- build:doc:html
|
||||||
script:
|
script:
|
||||||
- /usr/local/bin/entrypoint --url file://$(pwd)/doc/LdapSaisie.html --pdf doc/LdapSaisie.pdf
|
- rm -f doc/LdapSaisie.pdf
|
||||||
|
- /usr/local/bin/entrypoint --url file://$(pwd)/doc/LdapSaisie.html --pdf doc/LdapSaisie.pdf || test -f doc/LdapSaisie.pdf
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- doc/LdapSaisie.pdf
|
- doc/LdapSaisie.pdf
|
||||||
|
@ -135,8 +166,10 @@ build:doc:epub:
|
||||||
image:
|
image:
|
||||||
name: pandoc/core
|
name: pandoc/core
|
||||||
entrypoint: ["/bin/sh", "-c"]
|
entrypoint: ["/bin/sh", "-c"]
|
||||||
|
only:
|
||||||
|
- master
|
||||||
needs:
|
needs:
|
||||||
- build:doc
|
- build:doc:html
|
||||||
before_script:
|
before_script:
|
||||||
- apk add make
|
- apk add make
|
||||||
script:
|
script:
|
||||||
|
@ -147,14 +180,58 @@ build:doc:epub:
|
||||||
paths:
|
paths:
|
||||||
- doc/LdapSaisie.epub
|
- doc/LdapSaisie.epub
|
||||||
|
|
||||||
publish:
|
build:doc:append_additional_versions:
|
||||||
|
stage: build
|
||||||
|
image: python:alpine
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
needs:
|
||||||
|
- build:doc:html
|
||||||
|
- build:doc:pdf
|
||||||
|
- build:doc:epub
|
||||||
|
before_script:
|
||||||
|
- apk add git
|
||||||
|
- git config user.name $GITLAB_USER_NAME
|
||||||
|
- git config user.email $GITLAB_USER_EMAIL
|
||||||
|
- VERSION=`git describe --tags`
|
||||||
|
- cd doc
|
||||||
|
- git fetch origin $DOC_BRANCH
|
||||||
|
- git rev-parse --verify $DOC_BRANCH && git branch -D $DOC_BRANCH || echo "No existing local git $DOC_BRANCH branch"
|
||||||
|
- git checkout -b $DOC_BRANCH origin/$DOC_BRANCH
|
||||||
|
- git pull origin $DOC_BRANCH
|
||||||
|
script:
|
||||||
|
- cp LdapSaisie.html LdapSaisie.pdf LdapSaisie.epub dist/$VERSION/
|
||||||
|
- git add dist/$VERSION/
|
||||||
|
- git commit --amend --no-edit
|
||||||
|
- git push --force $DOC_REMOTE $DOC_BRANCH
|
||||||
|
|
||||||
|
publish:doc:
|
||||||
stage: publish
|
stage: publish
|
||||||
image: alpine:latest
|
image: alpine:latest
|
||||||
|
only:
|
||||||
|
- master
|
||||||
needs:
|
needs:
|
||||||
- 'build:doc'
|
- build:doc:append_additional_versions
|
||||||
- 'build:doc:pdf'
|
before_script:
|
||||||
- 'build:doc:epub'
|
- apk update && apk add git openssh-client rsync
|
||||||
- 'build:snapshot'
|
- eval $(ssh-agent -s)
|
||||||
|
- echo "$SSH_PRIVATE_KEY" | base64 -d | ssh-add -
|
||||||
|
- mkdir ~/.ssh
|
||||||
|
- echo "$SSH_HOST_KEY" | base64 -d > ~/.ssh/known_hosts
|
||||||
|
- git fetch origin $DOC_BRANCH
|
||||||
|
- git rev-parse --verify $DOC_BRANCH && git branch -D $DOC_BRANCH || echo "No existing local git $DOC_BRANCH branch"
|
||||||
|
- git checkout -b $DOC_BRANCH origin/$DOC_BRANCH
|
||||||
|
- git pull origin $DOC_BRANCH
|
||||||
|
script:
|
||||||
|
- rsync -atv --exclude '.git*' --delete --progress ./doc/dist/ $SSH_USER@$SSH_HOST:doc/
|
||||||
|
|
||||||
|
publish:snapshot:
|
||||||
|
stage: publish
|
||||||
|
image: alpine:latest
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
needs:
|
||||||
|
- build:snapshot
|
||||||
before_script:
|
before_script:
|
||||||
- apk update && apk add openssh-client rsync
|
- apk update && apk add openssh-client rsync
|
||||||
- eval $(ssh-agent -s)
|
- eval $(ssh-agent -s)
|
||||||
|
@ -162,15 +239,15 @@ publish:
|
||||||
- mkdir ~/.ssh
|
- mkdir ~/.ssh
|
||||||
- echo "$SSH_HOST_KEY" | base64 -d > ~/.ssh/known_hosts
|
- echo "$SSH_HOST_KEY" | base64 -d > ~/.ssh/known_hosts
|
||||||
script:
|
script:
|
||||||
- rsync -atv --exclude '.git*' --delete --progress ./doc/public_html/ $SSH_USER@$SSH_HOST:doc/
|
|
||||||
- rsync -atv ./doc/LdapSaisie.html ./doc/LdapSaisie.pdf ./doc/LdapSaisie.epub $SSH_USER@$SSH_HOST:doc/
|
|
||||||
- rsync -atv ldapsaisie-snapshot.tar.gz $SSH_USER@$SSH_HOST:download/ldapsaisie-snapshot.tar.gz
|
- rsync -atv ldapsaisie-snapshot.tar.gz $SSH_USER@$SSH_HOST:download/ldapsaisie-snapshot.tar.gz
|
||||||
|
|
||||||
publish:debian-sid:
|
publish:debian-sid:
|
||||||
stage: publish
|
stage: publish
|
||||||
image: debian:stable-slim
|
image: debian:stable-slim
|
||||||
|
only:
|
||||||
|
- master
|
||||||
needs:
|
needs:
|
||||||
- 'build:debian-sid'
|
- build:debian-sid
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update
|
- apt-get update
|
||||||
- apt-get install -y --no-install-recommends rsync openssh-client dupload
|
- apt-get install -y --no-install-recommends rsync openssh-client dupload
|
||||||
|
|
1
doc/.gitignore
vendored
1
doc/.gitignore
vendored
|
@ -3,3 +3,4 @@ LdapSaisie.html
|
||||||
LdapSaisie.pdf
|
LdapSaisie.pdf
|
||||||
LdapSaisie.epub
|
LdapSaisie.epub
|
||||||
venv
|
venv
|
||||||
|
dist
|
||||||
|
|
|
@ -4,7 +4,9 @@ public_html: venv
|
||||||
venv/bin/mkdocs build -s
|
venv/bin/mkdocs build -s
|
||||||
|
|
||||||
LdapSaisie.html: venv public_html
|
LdapSaisie.html: venv public_html
|
||||||
venv/bin/htmlark public_html/print_page/index.html -o LdapSaisie.html
|
venv/bin/htmlark public_html/print_page/index.html -o LdapSaisie.tmp.html
|
||||||
|
venv/bin/python clean-all-in-one-html-file.py LdapSaisie.tmp.html LdapSaisie.html
|
||||||
|
rm -f LdapSaisie.tmp.html
|
||||||
|
|
||||||
LdapSaisie.pdf: LdapSaisie.html
|
LdapSaisie.pdf: LdapSaisie.html
|
||||||
docker run -v $(CURDIR):/workspace pink33n/html-to-pdf --url file:///workspace/LdapSaisie.html --pdf LdapSaisie.pdf
|
docker run -v $(CURDIR):/workspace pink33n/html-to-pdf --url file:///workspace/LdapSaisie.html --pdf LdapSaisie.pdf
|
||||||
|
@ -26,6 +28,7 @@ LdapSaisie.epub: LdapSaisie.html
|
||||||
|
|
||||||
venv:
|
venv:
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
|
venv/bin/python -m pip install --upgrade pip setuptools
|
||||||
venv/bin/python -m pip install -r requirements.txt
|
venv/bin/python -m pip install -r requirements.txt
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
40
doc/clean-all-in-one-html-file.py
Normal file
40
doc/clean-all-in-one-html-file.py
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
import sys
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
# Check & handle arguments
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
print(f'Usage: {sys.argv[0]} [/path/to/input.html] [/path/to/output.html]')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
input_path = sys.argv[1]
|
||||||
|
|
||||||
|
if not os.path.exists(input_path):
|
||||||
|
print(f'{input_path} not found')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
output_path = sys.argv[2] if len(sys.argv) > 2 else input_path
|
||||||
|
|
||||||
|
# Open & parse HTML input file
|
||||||
|
with open(input_path, 'r') as fp:
|
||||||
|
soup = BeautifulSoup(fp, 'html.parser')
|
||||||
|
|
||||||
|
# Delete some useless elements
|
||||||
|
to_delete = [
|
||||||
|
(['div'], {'class': 'md-sidebar'}),
|
||||||
|
(['div'], {'class': 'md-search'}),
|
||||||
|
(['label'], {'for': '__search'}),
|
||||||
|
(['div'], {'id': 'print-site-banner'}),
|
||||||
|
(['div'], {'class': 'md-header__source'}),
|
||||||
|
]
|
||||||
|
for args, kwargs in to_delete:
|
||||||
|
for el in soup.find_all(*args, **kwargs):
|
||||||
|
el.decompose()
|
||||||
|
|
||||||
|
# Change LdapSaisie logo header link to JS scroll top action
|
||||||
|
soup.find('a', attrs={'class': 'md-logo'})['href'] = 'javascript:window.scrollTo(0,0)'
|
||||||
|
|
||||||
|
# Store resulting HTML document in output file
|
||||||
|
with open(output_path, 'w') as fp:
|
||||||
|
fp.write(str(soup))
|
|
@ -1,9 +1,11 @@
|
||||||
site_name: LdapSaisie
|
site_name: LdapSaisie
|
||||||
site_description: Documentation
|
site_description: Documentation
|
||||||
site_author: Benjamin Renard <brenard@easter-eggs.com / brenard@zionetrix.net>
|
site_author: Benjamin Renard <brenard@easter-eggs.com / brenard@zionetrix.net>
|
||||||
|
site_url: https://ldapsaisie.org/doc/
|
||||||
copyright: Easter-eggs
|
copyright: Easter-eggs
|
||||||
docs_dir: 'src'
|
docs_dir: 'src'
|
||||||
site_dir: 'public_html'
|
site_dir: 'public_html'
|
||||||
|
repo_name: ee/ldapsaisie
|
||||||
repo_url: https://gitlab.easter-eggs.com/ee/ldapsaisie
|
repo_url: https://gitlab.easter-eggs.com/ee/ldapsaisie
|
||||||
|
|
||||||
theme:
|
theme:
|
||||||
|
@ -18,10 +20,19 @@ theme:
|
||||||
|
|
||||||
extra:
|
extra:
|
||||||
homepage: https://ldapsaisie.org
|
homepage: https://ldapsaisie.org
|
||||||
|
version:
|
||||||
|
provider: mike
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
- search:
|
- search:
|
||||||
lang: fr # Set language for search
|
lang: fr # Set language for search
|
||||||
|
- mike:
|
||||||
|
alias_type: symlink
|
||||||
|
deploy_prefix: doc/dist
|
||||||
|
canonical_version: dev
|
||||||
|
version_selector: true
|
||||||
|
css_dir: css
|
||||||
|
javascript_dir: js
|
||||||
- print-site:
|
- print-site:
|
||||||
add_to_navigation: true
|
add_to_navigation: true
|
||||||
print_page_title: 'Documentation'
|
print_page_title: 'Documentation'
|
||||||
|
|
|
@ -6,3 +6,6 @@ mkdocs-print-site-plugin==1.3.0
|
||||||
html5lib
|
html5lib
|
||||||
requests
|
requests
|
||||||
htmlark
|
htmlark
|
||||||
|
mike
|
||||||
|
git+https://github.com/jimporter/mike.git@master
|
||||||
|
beautifulsoup4
|
||||||
|
|
Loading…
Reference in a new issue