add support for gitlab pages
| 1 | 1 | image: python:latest
|
| 2 | 2 | |
| 3 | -before_script:
|
|
| 4 | - - python -V # Print out python version for debugging
|
|
| 5 | - - pip install virtualenv
|
|
| 6 | - - virtualenv venv
|
|
| 7 | - - source venv/bin/activate
|
|
| 8 | - - pip install -q -r requirements.txt
|
|
| 9 | - |
|
| 10 | 3 | test:
|
| 11 | - script:
|
|
| 12 | - - sphinx-build -nW -b html -d _build/doctrees source _build/html |
|
| 4 | + before_script:
|
|
| 5 | + - python -V
|
|
| 6 | + - pip install virtualenv
|
|
| 7 | + - virtualenv venv
|
|
| 8 | + - source venv/bin/activate
|
|
| 9 | + - pip install -q -r requirements.txt
|
|
| 10 | + script:
|
|
| 11 | + - sphinx-build -nW -b html -d _build/doctrees source _build/html
|
|
| 12 | + |
|
| 13 | +pages:
|
|
| 14 | + stage: build
|
|
| 15 | + cache:
|
|
| 16 | + key: gitlab-pages
|
|
| 17 | + paths: [public]
|
|
| 18 | + before_script:
|
|
| 19 | + - python -V
|
|
| 20 | + - pip install virtualenv
|
|
| 21 | + - virtualenv venv
|
|
| 22 | + - source venv/bin/activate
|
|
| 23 | + - pip install -q -r requirements.txt
|
|
| 24 | + - mkdir -p public/previews
|
|
| 25 | + - rm -rf public/previews/$CI_COMMIT_REF_SLUG
|
|
| 26 | + script:
|
|
| 27 | + - sphinx-build -b html source public/previews/$CI_COMMIT_REF_SLUG
|
|
| 28 | + - cd public/previews/
|
|
| 29 | + - echo "<html><body><h1>$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME</h1><p>Official build documentation is on readthedocs.org, this page is only here for dev purpose :</p><ul>" > ../index.html
|
|
| 30 | + - find -type d -mindepth 1 -maxdepth 1 -exec echo "<li><a href='previews/{}'>{}</a></li>" \; >> ../index.html
|
|
| 31 | + - echo "</ul></body></html>" >> ../index.html
|
|
| 32 | + environment:
|
|
| 33 | + name: pages/$CI_COMMIT_BRANCH
|
|
| 34 | + action: start
|
|
| 35 | + url: $CI_PAGES_URL/$CURRENT_CONTENT_PATH
|
|
| 36 | + on_stop: pages-clean-preview
|
|
| 37 | + resource_group: one-gitlab-pages-for-all-branches
|
|
| 38 | + artifacts:
|
|
| 39 | + paths:
|
|
| 40 | + - public
|
|
| 41 | + |
|
| 42 | +pages-clean-preview:
|
|
| 43 | + stage: build
|
|
| 44 | + cache:
|
|
| 45 | + key: gitlab-pages
|
|
| 46 | + paths: [public]
|
|
| 47 | + variables:
|
|
| 48 | + GIT_STRATEGY: none
|
|
| 49 | + FOLDER_TO_DELETE: previews/$CI_COMMIT_REF_SLUG
|
|
| 50 | + script:
|
|
| 51 | + - rm -rf public/$FOLDER_TO_DELETE
|
|
| 52 | + environment:
|
|
| 53 | + name: pages/$CI_COMMIT_BRANCH
|
|
| 54 | + action: stop
|
|
| 55 | + rules:
|
|
| 56 | + - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
|
|
| 57 | + when: manual
|
|
| 58 | + allow_failure: true |
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help