1
+ services :
2
+ - docker:dind
3
+
4
+ stages :
5
+ - prepare_release
6
+ - release
7
+ - push
8
+
9
+ release_msg_job :
10
+ stage : prepare_release
11
+ image : alpine:latest
12
+ script :
13
+ - TAG_NAME=$(awk '/^## /{sub(/^## /, ""); print; exit}' CHANGELOG.md)
14
+ - TAG_MESSAGE=$(awk '/^### /{flag=1} /^## /{if(flag) exit} flag' CHANGELOG.md)
15
+ - TAG_MESSAGE_BASE64=$(echo -n "${TAG_MESSAGE}" | base64 -w 0)
16
+ - echo "TAG_NAME=${TAG_NAME}" >> release_variables.env
17
+ - echo "TAG_MESSAGE=${TAG_MESSAGE_BASE64}" >> release_variables.env
18
+ before_script :
19
+ - apk update && apk upgrade
20
+ variables :
21
+ GIT_STRATEGY : clone
22
+ artifacts :
23
+ reports :
24
+ dotenv : release_variables.env
25
+ tags :
26
+ - Docker
27
+ - Centos9
28
+ - IT4I_Network
29
+ only :
30
+ - master
31
+
32
+ release_job :
33
+ stage : release
34
+ image : registry.gitlab.com/gitlab-org/release-cli:latest
35
+ needs :
36
+ - job : release_msg_job
37
+ artifacts : true
38
+ script :
39
+ - echo "Creating RELEASE \"$TAG_NAME"\"
40
+ - git config --global user.name "HEAppE Pipeline"
41
+ - git config --global user.email "support.heappe@it4i.cz"
42
+ - git checkout master
43
+ - git status
44
+ before_script :
45
+ - apk update && apk upgrade
46
+ - apk add git
47
+ release :
48
+ name : ' ${TAG_NAME}'
49
+ description : ' $(echo "${TAG_MESSAGE}" | base64 -d)'
50
+ tag_name : ' ${TAG_NAME}'
51
+ variables :
52
+ GIT_STRATEGY : clone
53
+ tags :
54
+ - Docker
55
+ - Centos9
56
+ - IT4I_Network
57
+ only :
58
+ - master
59
+
60
+ push_to_github_job :
61
+ stage : push
62
+ needs :
63
+ - job : release_msg_job
64
+ artifacts : true
65
+ image : alpine:latest
66
+ script :
67
+ - git config --global user.name "HEAppE Pipeline"
68
+ - git config --global user.email "support.heappe@it4i.cz"
69
+ - git checkout origin/master
70
+ - git remote add github https://x-access-token:$GITHUB_TOKEN@github.com/It4innovations/HEAppE-scripts.git
71
+ - git push github HEAD:$CI_COMMIT_REF_NAME
72
+ - git push github --tags
73
+ - echo "${TAG_MESSAGE}"
74
+ - MODIFICATION_TAG_MESSAGE=$(echo "${TAG_MESSAGE}" | base64 -d | sed '/^[[:space:]]*$/s/^.*$/\\n/' | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g')
75
+ - echo "${MODIFICATION_TAG_MESSAGE}"
76
+ - |
77
+ curl -L -X POST -H "Authorization: token $GITHUB_TOKEN" -d '{
78
+ "tag_name": "'"${TAG_NAME}"'",
79
+ "name": "'"${TAG_NAME}"'",
80
+ "body": "'"${MODIFICATION_TAG_MESSAGE}"'",
81
+ "draft": false,
82
+ "prerelease": false
83
+ }' https://api.github.com/repos/It4innovations/HEAppE-scripts/releases
84
+ before_script :
85
+ - apk update && apk upgrade
86
+ - apk add --no-cache git curl jq
87
+ variables :
88
+ GIT_STRATEGY : clone
89
+ tags :
90
+ - Docker
91
+ - Centos9
92
+ - IT4I_Network
93
+ only :
94
+ - master
0 commit comments