-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
.gitlab-ci.yml
64 lines (58 loc) · 1.74 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
image: python:3.10 # change to match your python version
stages:
- test
- release
lint:
stage: test
before_script:
- python -m pip install --upgrade pip
- pip install poetry
- poetry install --with dev
script:
- poetry run pre-commit run
test:
stage: test
before_script:
- python -m pip install --upgrade pip
- pip install poetry
- poetry install --with dev
script:
- poetry run pytest .
publish_docker_on_master:
stage: release
when: on_success
image: docker:stable
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
services:
- docker:dind
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build --build-arg REGISTRY=$CI_REGISTRY_IMAGE -t $CI_REGISTRY_IMAGE/rats:master .
- docker push $CI_REGISTRY_IMAGE/rats:master
only:
- master
publish_docker_on_tags:
stage: release
when: on_success
image: docker:stable
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
services:
- docker:dind
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build --build-arg REGISTRY=$CI_REGISTRY_IMAGE -t $CI_REGISTRY_IMAGE/rats:$CI_COMMIT_TAG -t $CI_REGISTRY_IMAGE/rats:latest .
- docker push $CI_REGISTRY_IMAGE/rats:$CI_COMMIT_TAG
only:
- tags
release_on_tags:
stage: release
when: on_success
script:
- |
curl --header 'Content-Type: application/json' --header "PRIVATE-TOKEN: $GITLAB_PAT"
--data '{ "name": "$CI_COMMIT_TITLE", "tag_name": "$CI_COMMIT_TAG", "description": "$CI_COMMIT_MESSAGE" }'
--request POST https://gitlab.com/api/v4/projects/StegSchreck%2FRatS/releases
only:
- tags