Skip to content
Snippets Groups Projects
Commit 315e29ee authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

Merge branch 'automate-index' into 'develop'

Automate index

See merge request R3/howto-cards!161
parents baccec14 860cd61c
No related branches found
No related tags found
No related merge requests found
......@@ -2,10 +2,63 @@
image: git-r3lab.uni.lu:4567/r3/docker/jekyll-lcsb:1.6
stages:
- prepare
- save
- build
- generate
- deploy
# prepare
# ------------------------------------------------------------------------------------
prepare:index:
image: python
stage: prepare
rules:
- if: $CI_COMMIT_BRANCH
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_COMMIT_MESSAGE !~ /tmpBranch/ && $CI_COMMIT_MESSAGE !~ /Update index/'
script:
- python .ci/generateIndex.py
- mkdir .tmp
- cp index.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/'
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/index.md .
- rm -rf .tmp
# commit
- git branch -D tmpBranch || true
- git checkout -b tmpBranch
- git add --all
- git commit -m "Update index"
- git checkout $CI_COMMIT_REF_NAME
- git pull origin $CI_COMMIT_REF_NAME
- git merge tmpBranch --ff
- git push origin $CI_COMMIT_REF_NAME || true
- git branch -D tmpBranch
# build
# ------------------------------------------------------------------------------------
......
......@@ -64,4 +64,4 @@ The How-to cards are intended to provide practical guidance in implementing Data
</ul>
</div>
</div>
</div>
\ No newline at end of file
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