Something went wrong on our end
-
Geoffrey Arthaud authoredGeoffrey Arthaud authored
.gitlab-ci.yml 2.17 KiB
variables:
WORKON_HOME: .pipenv/venvs
PIP_CACHE_DIR: .pipenv/pipcache
stages:
- deploy_dev
- package_test
- deploy
build_and_deploy_gitlab:
image: nikolaik/python-nodejs:python3.11-nodejs20
stage: deploy_dev
script:
- pip install pipenv
- pipenv install
- npm ci --cache .npm --prefer-offline
- curl -sSLf "$(curl -sSLf https://api.github.com/repos/tomwright/dasel/releases/latest | grep browser_download_url | grep linux_amd64 | grep -v .gz | cut -d\" -f 4)" -L -o dasel && chmod +x dasel
- NEW_VERSION=`./dasel -f pyproject.toml -r toml "project.join(+,version,string(${CI_COMMIT_SHORT_SHA}))" | tr -d "'"`
- ./dasel put -f pyproject.toml -r toml -t string -v ${NEW_VERSION} project.version
- pipenv run npm run build:prod
- pipenv run python -m build
- 'echo "Déploiement de la version : ${NEW_VERSION}"'
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token pipenv run python -m twine upload --skip-existing --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
- echo ${NEW_VERSION} > version.txt
cache:
paths:
- .npm/
- .pipenv/
artifacts:
paths:
- version.txt
expire_in: "2 days"
rules:
- if: $CI_COMMIT_BRANCH == "main"
deploy_exemple_site:
image: python:3.11.6-bookworm
stage: package_test
script:
- VERSION=`cat version.txt`
- git clone --branch develop --single-branch --depth=1 ${CI_SERVER_URL}/pub/numeco/mkdocs-dsfr-exemple.git
- cd mkdocs-dsfr-exemple
- pip install pipenv
- pipenv install --index gitlab mkdocs-dsfr==${VERSION}
- pipenv run mkdocs build --strict --verbose -d ../public
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == "main"
deploy_pypi:
image: nikolaik/python-nodejs:python3.11-nodejs20
stage: deploy_dev
script:
- pip install pipenv
- pipenv install
- npm ci --cache .npm --prefer-offline
- pipenv run npm run build:prod
- pipenv run python -m build
- TWINE_PASSWORD=${PYPI_PASSWORD} TWINE_USERNAME=${PYPI_USER} pipenv run python -m twine upload --skip-existing dist/*
cache:
paths:
- .npm/
- .pipenv/
rules:
- if: $CI_COMMIT_TAG