Verified Commit 8674f153 authored by Laurent Heirendt's avatar Laurent Heirendt
Browse files

add automated commit of index

parent f41486c9
Pipeline #53723 passed with stages
in 1 minute and 23 seconds
......@@ -2,11 +2,76 @@
image: $CI_REGISTRY/r3/docker/jekyll-lcsb:1.8
stages:
- prepare
- save
- build
- deploy
- backup
- recovery
.global_settings_mr: &global_settings_mr
rules:
# run the job for master or develop
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "develop"'
# run the job for a merge request
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
.global_settings_mr_no_fork_bot: &global_settings_mr_no_fork_bot
rules:
# run the job for a merge request, but not from a fork, and not when the commit message has been set by the bot
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH == "R3/r3-pages" && $CI_COMMIT_MESSAGE !~ /tmpBranch/ && $CI_COMMIT_MESSAGE !~ /Update index/'
# prepare
# ------------------------------------------------------------------------------------
prepare:index:
image: python
stage: prepare
before_script:
- pip install natsort
- mkdir .tmp
script:
- python .ci/generateIndex.py
- cp frozen.md .tmp/.
artifacts:
expire_in: 1 day
paths:
- .tmp
<<: *global_settings_mr
# save
# ------------------------------------------------------------------------------------
save:commitIndex:
image:
name: alpine/git
entrypoint: [""]
stage: save
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/frozen.md .
- rm -rf .tmp
# commit
- git branch -D tmpBranch || true
- git checkout -b tmpBranch || true
- git add cards.md || true
- git commit -m "Update index" || true
- git checkout $CI_COMMIT_REF_NAME || true
- git pull origin $CI_COMMIT_REF_NAME || true
- git merge tmpBranch --ff || true
- git push origin $CI_COMMIT_REF_NAME || true
- git branch -D tmpBranch || true
<<: *global_settings_mr_no_fork_bot
build the website:
stage: build
before_script:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment