Skip to content
Snippets Groups Projects
Commit 2af9f153 authored by Niccolò Betto's avatar Niccolò Betto
Browse files

Introduce versioned CI build based on tags

parent bcab6f43
Branches
Tags
No related merge requests found
Pipeline #10627 passed
......@@ -2,17 +2,29 @@ variables:
GIT_SUBMODULE_STRATEGY: recursive
stages:
- docker
- build
docker:
stage: docker
build:
stage: build
image: docker
tags:
- docker
rules:
# If triggered by a push to the default branch...
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
VERSION: "latest" # ...push to latest...
changes:
- Dockerfile # ...only if Dockerfile changed
# If triggered by tag creation...
- if: $CI_COMMIT_TAG
variables:
VERSION: $CI_COMMIT_TAG # ...push to tag name
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE:latest .
- docker push $CI_REGISTRY_IMAGE:latest
rules:
- changes:
- Dockerfile
- docker build -t $CI_REGISTRY_IMAGE:$VERSION .
- docker push $CI_REGISTRY_IMAGE:$VERSION
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment