-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
94 lines (90 loc) · 2.58 KB
/
.gitlab-ci.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
services:
- docker:dind
stages:
- prepare_release
- release
- push
release_msg_job:
stage: prepare_release
image: alpine:latest
script:
- TAG_NAME=$(awk '/^## /{sub(/^## /, ""); print; exit}' CHANGELOG.md)
- TAG_MESSAGE=$(awk '/^### /{flag=1} /^## /{if(flag) exit} flag' CHANGELOG.md)
- TAG_MESSAGE_BASE64=$(echo -n "${TAG_MESSAGE}" | base64 -w 0)
- echo "TAG_NAME=${TAG_NAME}" >> release_variables.env
- echo "TAG_MESSAGE=${TAG_MESSAGE_BASE64}" >> release_variables.env
before_script:
- apk update && apk upgrade
variables:
GIT_STRATEGY: clone
artifacts:
reports:
dotenv: release_variables.env
tags:
- Docker
- Centos9
- IT4I_Network
only:
- master
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- job: release_msg_job
artifacts: true
script:
- echo "Creating RELEASE \"$TAG_NAME"\"
- git config --global user.name "HEAppE Pipeline"
- git config --global user.email "[email protected]"
- git checkout master
- git status
before_script:
- apk update && apk upgrade
- apk add git
release:
name: '${TAG_NAME}'
description: '$(echo "${TAG_MESSAGE}" | base64 -d)'
tag_name: '${TAG_NAME}'
variables:
GIT_STRATEGY: clone
tags:
- Docker
- Centos9
- IT4I_Network
only:
- master
push_to_github_job:
stage: push
needs:
- job: release_msg_job
artifacts: true
image: alpine:latest
script:
- git config --global user.name "HEAppE Pipeline"
- git config --global user.email "[email protected]"
- git checkout origin/master
- git remote add github https://x-access-token:[email protected]/It4innovations/HEAppE-scripts.git
- git push github HEAD:$CI_COMMIT_REF_NAME
- git push github --tags
- echo "${TAG_MESSAGE}"
- MODIFICATION_TAG_MESSAGE=$(echo "${TAG_MESSAGE}" | base64 -d | sed '/^[[:space:]]*$/s/^.*$/\\n/' | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g')
- echo "${MODIFICATION_TAG_MESSAGE}"
- |
curl -L -X POST -H "Authorization: token $GITHUB_TOKEN" -d '{
"tag_name": "'"${TAG_NAME}"'",
"name": "'"${TAG_NAME}"'",
"body": "'"${MODIFICATION_TAG_MESSAGE}"'",
"draft": false,
"prerelease": false
}' https://api.github.com/repos/It4innovations/HEAppE-scripts/releases
before_script:
- apk update && apk upgrade
- apk add --no-cache git curl jq
variables:
GIT_STRATEGY: clone
tags:
- Docker
- Centos9
- IT4I_Network
only:
- master