Skip to content
Snippets Groups Projects
Commit 824b12b9 authored by jurgenhaas's avatar jurgenhaas
Browse files

Add CI/CD for building and deploying mkdocs project

parent e4a814b8
No related branches found
No related tags found
No related merge requests found
stages:
- build
- deploy
Build:
stage: build
tags:
- default
script:
- export WORKDIR=$(php /usr/local/bin/volume.php | cut -d":" -f 1)/${LAKEDROPS_PATH}
- echo "WorkDir is ${WORKDIR}"
- docker-compose up -d
- sleep 20
- docker-compose exec -T --workdir=/mkdocs mkdocs mkdocs build
- docker-compose down
artifacts:
name: build
when: always
paths:
- site/
only:
- main
- merge_requests
Deploy:
stage: deploy
tags:
- ansible
variables:
GIT_STRATEGY: none
script:
- a -m synchronize -a "src=${PWD}/site/ dest=${LAKEDROPS_BASE_PATH} delete=yes" --limit=${LAKEDROPS_HOST}
cache: {}
only:
- main
DeployMR:
stage: deploy
tags:
- ansible
variables:
GIT_STRATEGY: none
script:
- a -m file -a "dest=${LAKEDROPS_BASE_PATH}-mr/${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} state=directory" --limit=${LAKEDROPS_HOST}
- a -m synchronize -a "src=${PWD}/site/ dest=${LAKEDROPS_BASE_PATH}-mr/${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} delete=yes" --limit=${LAKEDROPS_HOST}
environment:
name: review/$CI_COMMIT_REF_SLUG
url: https://${LAKEDROPS_DOMAIN}/MR/$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
on_stop: CleanupDeployMR
cache: {}
only:
- merge_requests
CleanupDeployMR:
stage: deploy
tags:
- ansible
variables:
GIT_STRATEGY: none
script:
- a -m file -a "path=${LAKEDROPS_BASE_PATH}-mr/${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} state=absent" --limit=${LAKEDROPS_HOST}
environment:
name: review/$CI_COMMIT_REF_SLUG
action: stop
cache: {}
rules:
- if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "develop"'
when: never
- if: '$CI_MERGE_REQUEST_ID || $CI_PIPELINE_SOURCE == "pipeline"|| $CI_PIPELINE_SOURCE == "trigger"'
allow_failure: true
when: manual
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