-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
99 lines (92 loc) · 2.71 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
95
96
97
98
99
stages:
- .pre
- prepare
- release
- publish
.publish-common:
artifacts:
paths:
- univention-ucs_modules-*
expire_in: 14 days
before_script:
# Check if release has to be build
- if [ -z "$RELEASE_VERSION" ]; then exit 0; fi
# Set new semantic-release version
- if [[ ${CI_COMMIT_BRANCH} != "main" ]];
then
VERSION=${RELEASE_VERSION}-dev${CI_PIPELINE_IID};
else
VERSION=${RELEASE_VERSION};
fi
- sed -i "/version. \"[0-9]\.[0-9]\.[0-9]\"/s/[0-9]\.[0-9]\.[0-9]/$VERSION/" galaxy.yml
image: artifacts.knut.univention.de/upx/container-tooling/automation-ansible:main
script:
- ansible-galaxy collection build
- ansible-galaxy collection publish --api-key ${ANSIBLE_GALAXY_API_KEY} univention-ucs_modules-${VERSION}.tar.gz
stage: publish
variables:
GIT_DEPTH: "1"
.common-semantic-release:
except:
- triggers
- tags
image: artifacts.knut.univention.de/upx/container-tooling/automation-semantic-release:main
stage: prepare
variables:
GIT_STRATEGY: clone
NODE_EXTRA_CA_CERTS: "/usr/local/share/ca-certificates/ucs-root-ca.crt"
prepare:
artifacts:
reports:
dotenv: ${CI_PROJECT_DIR}/deploy.env
extends: .common-semantic-release
script:
- echo RELEASE_VERSION=$(semantic-release --dry-run --branches $CI_COMMIT_REF_NAME --plugins "@semantic-release/gitlab" | grep -oP "Published release [0-9]+\.[0-9]+\.[0-9]+ on" | grep -oP "[0-9]+\.[0-9]+\.[0-9]+") > ${CI_PROJECT_DIR}/deploy.env
- cat ${CI_PROJECT_DIR}/deploy.env
stage: prepare
lint:
before_script:
- rm -rf ${CI_BUILDS_DIR}/ci-tooling
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/univention/customers/dataport/dps/helper/ci-tooling.git ${CI_BUILDS_DIR}/ci-tooling
image: artifacts.knut.univention.de/upx/container-tooling/automation-linting:main
except:
refs:
- triggers
- tags
variables:
- $DISABLE_LINT =~ "true"
script:
- |
if ! test -z ${VAULT_PASSWORD}
then
ln -s ${VAULT_PASSWORD} ${VAULT_PASSWORD_PATH}
fi
- pre-commit run --all-files --config .pre-commit-config.yaml --verbose
stage: prepare
release:
artifacts:
paths:
- CHANGELOG.md
extends: .common-semantic-release
only:
- main
script:
- |
if test -f "${CI_PROJECT_DIR}/.releaserc"
then
PLUGINS=
else
PLUGINS="--plugins @semantic-release/gitlab,@semantic-release/release-notes-generator,@semantic-release/changelog"
fi
- semantic-release --branches $CI_COMMIT_REF_NAME $PLUGINS
stage: release
publish-main:
extends: .publish-common
only:
- main
publish-mr:
except:
- main
- tags
extends: .publish-common
when: manual