Skip to content
Snippets Groups Projects
Commit 82695d0a authored by Moul's avatar Moul
Browse files

CI: Introduce website stage (#433)

trigger job only on default branch

`htmlcov` is necessary at the root of the repository
to build the website with the coverage in

Push on `pages` branch with an access token
set in CI/CD variables

The access token has to be renew every year,
since it’s the maximum lifespan of an access token

Access token has to be created on a project basis with
`repository_write` checked and Developer role

https://www.benjaminrancourt.ca/how-to-push-to-a-git-repository-from-a-gitlab-ci-pipeline/
https://stackoverflow.com/questions/51716044
https://stackoverflow.com/questions/25409700
https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html
parent 5f7727bc
No related branches found
No related tags found
1 merge request!271Set up new website structure with MkDocs (#433)
...@@ -2,7 +2,7 @@ stages: ...@@ -2,7 +2,7 @@ stages:
- checks - checks
- tests - tests
- package - package
- coverage - website
variables: variables:
DOCKER_IMAGE: "registry.duniter.org/docker/python3/poetry" DOCKER_IMAGE: "registry.duniter.org/docker/python3/poetry"
...@@ -216,14 +216,18 @@ release: ...@@ -216,14 +216,18 @@ release:
tag_name: "$CI_COMMIT_TAG" tag_name: "$CI_COMMIT_TAG"
description: "$CI_COMMIT_TAG" description: "$CI_COMMIT_TAG"
pages: website:
extends: .changes stage: website
needs: ["tests:3.12:cov"] needs: ["tests:3.12:cov"]
variables:
RELEASE: "0.12"
rules: rules:
- if: $CI_COMMIT_BRANCH == "main" - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
stage: coverage script:
script: mv cov_html/ public/ - poetry install --only docs
artifacts: - git fetch origin pages --depth=1
paths: - git config user.name $GITLAB_USER_NAME
- public - git config user.email $GITLAB_USER_EMAIL
expire_in: 2 days - poetry run mike deploy $RELEASE
- git remote set-url origin "https://${TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git"
- git push origin pages
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment