-
Laurent Heirendt authoredLaurent Heirendt authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
stages:
- prepare
- save
- build
- generate
- deploy
- trigger
variables:
GIT_STRATEGY: clone
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
# prepare
# ------------------------------------------------------------------------------------
prepare:index:
image: python
stage: prepare
rules:
- if: $CI_COMMIT_REF_NAME
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_COMMIT_MESSAGE !~ /tmpBranch/ && $CI_COMMIT_MESSAGE !~ /Update index/'
before_script:
- pip install natsort
script:
- python .ci/generateIndex.py
- mkdir .tmp
- cp cards.md .tmp/.
artifacts:
expire_in: 1 day
paths:
- .tmp
# save
# ------------------------------------------------------------------------------------
save:commitIndex:
image:
name: alpine/git:latest
entrypoint: [""]
stage: save
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_COMMIT_MESSAGE !~ /tmpBranch/ && $CI_COMMIT_MESSAGE !~ /Update index/ && $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH == "R3/howto-cards"'
before_script:
- apk add git-lfs
- git fetch --all
- url_host=`git remote get-url origin | sed -e "s/https:\/\/gitlab-ci-token:.*@//g"`
- git remote set-url origin "https://$GIT_ACCESS_USER:$GIT_ACCESS_TOKEN@${url_host}"
- git config user.name $GIT_ACCESS_USER
- git config user.email $GIT_ACCESS_EMAIL
script:
# copy the index and remove the temporary directory
- cp .tmp/cards.md .
- rm -rf .tmp
# commit
- git branch -D tmpBranch || true
- git checkout -b tmpBranch || true
- git add --all || true
- git commit -m "Update index" || true
- git checkout $CI_COMMIT_REF_NAME || true
- git pull origin $CI_COMMIT_REF_NAME
- git merge tmpBranch --ff || true
- git push origin $CI_COMMIT_REF_NAME || true
- git branch -D tmpBranch || true
# build
# ------------------------------------------------------------------------------------
build:pages: