forked from yigbt/EcoToxFred
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
48 lines (39 loc) · 1.1 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
# SPDX-FileCopyrightText: 2024 Hannes Bohring <[email protected]>
# SPDX-FileCopyrightText: 2024 Helmholtz Centre for Environmental Research (UFZ)
#
# SPDX-License-Identifier: AGPL-3.0-only
---
stages:
- "build"
default:
interruptible: true
.docker_login: &docker_login
- 'echo "${CI_REGISTRY_PASSWORD}" | docker login --username "$CI_REGISTRY_USER" --password-stdin "${CI_REGISTRY}"'
.base_before_build_script:
image: "docker:27-dind"
services:
- "docker:27-dind"
build-latest:
stage: "build"
extends: ".base_before_build_script"
before_script:
- *docker_login
script:
- "docker build -t ${CI_REGISTRY_IMAGE}:latest ."
- "docker push --all-tags ${CI_REGISTRY_IMAGE}"
rules:
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
- when: "never"
build-release:
stage: "build"
extends: ".base_before_build_script"
before_script:
- *docker_login
script:
- "docker build -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG} ."
- "docker push --all-tags ${CI_REGISTRY_IMAGE}"
rules:
- if: '$CI_COMMIT_TAG =~ /^\d+.\d+.\d+/'
when: "always"
- when: "never"
...