-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
41 lines (38 loc) · 1.13 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
stages:
- test_and_build
- tag
variables:
GIT_STRATEGY: "clone"
job-build:
stage: test_and_build
tags:
- docker
- linux
image: docker:24.0-cli
services:
- docker:dind
script:
# upload process is managed by GitHub Actions;
# here we only need to check that project has no build errors.
- docker build --no-cache . -t mdocker
- docker run --rm -i mdocker /bin/sh -c "python3 -m poetry build"
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- when: manual
job-tag:
stage: tag
needs:
- job-build
script:
- USERNAME=$CUSTOM_CI_USERNAME
- PASSWORD=$CUSTOM_CI_PASSWORD
- EMAIL=$CUSTOM_CI_EMAIL
- TAGNAME=v$(sh scripts/get_version.sh)
- git config --global user.name "${USERNAME}"
- git config --global user.email "${EMAIL}"
- git remote remove origin
- git remote add origin https://${USERNAME}:${PASSWORD}@gitlab.com/${CI_PROJECT_PATH}
- if [ $(git tag | grep "$TAGNAME") ]; then echo "[ * ] Tag already exists, skipping.."; else git tag $TAGNAME && git push origin $TAGNAME; fi
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- when: manual