-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.example.yml
46 lines (40 loc) · 1.6 KB
/
.gitlab-ci.example.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
image: python:3.6
variables:
GIT_STRATEGY: clone
before_script:
- mkdir -p ~/.ssh
- 'which ssh-agent || ( apt-get update -y && apt-get install openssl-client -y )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- '[[ -f /.dockerenv ]] && echo -e "HOST *\n\nStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- pip install -r requirements.txt
stages:
- build
publish_version:
stage: build
script:
- CI_PUSH_REPO=$(echo "$CI_REPOSITORY_URL" | perl -pe 's#.*@(.+?(\:\d+)?)/#git@\1:#')
- CI_COMMIT_MESSAGE=$(git log --format=%B -n 1 "${CI_COMMIT_SHA}")
- CI_COMMIT_MESSAGE=${CI_COMMIT_MESSAGE,,}
- git config --global user.email "[email protected]"
- git config --global user.name "GitLab Bot"
- git remote set-url origin "${CI_PUSH_REPO}"
- git checkout "${CI_COMMIT_REF_NAME}"
- wget https://raw.githubusercontent.com/brunabxs/gitlab-changelog/master/ci_helper.py
- if [[ ! $CI_COMMIT_MESSAGE =~ (^update changelog.*) ]]; then python ci_helper.py publish_version -ge "${GITLAB_API_ENDPOINT}" -gt "${GITLAB_PERSONAL_ACCESS_TOKEN}" -proj "${CI_PROJECT_ID}" -sha "${CI_COMMIT_SHA}" -t "${CI_COMMIT_REF_NAME}"; fi
- rm ci_helper.py
only:
- master
- develop
tags:
- docker
create_mr:
stage: build
script:
- wget https://raw.githubusercontent.com/brunabxs/gitlab-changelog/master/ci_helper.py
- python ci_helper.py create_mr -ge "${GITLAB_API_ENDPOINT}" -gt "${GITLAB_PERSONAL_ACCESS_TOKEN}" -proj "${CI_PROJECT_ID}" -s master -t develop -tag "${CI_COMMIT_TAG}"
- rm ci_helper.py
only:
- /^\d+\.\d+\.\d+$/
tags:
- docker