Commit 715612e4 authored by pfandzelter's avatar pfandzelter
Browse files

add gorelease

parent 0ce5e776
Pipeline #39851 passed with stages
in 12 minutes and 46 seconds
......@@ -47,16 +47,33 @@ build:
script:
- make
container:
release:
stage: release
image: docker:stable
services:
- docker:dind
variables:
DOCKER_REGISTRY: $CI_REGISTRY
DOCKER_USERNAME: $CI_REGISTRY_USER
DOCKER_PASSWORD: $CI_REGISTRY_PASSWORD
# Disable shallow cloning so that goreleaser can diff between tags to
# generate a changelog.
GIT_DEPTH: 0
# Only run this release job for tags, not every commit (for example).
only:
- main
script:
- make container
- IFS='/' read -ra components <<< "$CI_COMMIT_REF_NAME"
- CONTAINER_TAG=${components[0]}
- if [ "$CI_COMMIT_REF_NAME" == "main" ]; then CONTAINER_TAG=latest; fi;
- echo $CONTAINER_TAG
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker tag git.tu-berlin.de:5000/mcc-fred/fred/fred git.tu-berlin.de:5000/mcc-fred/fred/fred:$CONTAINER_TAG
- docker push git.tu-berlin.de:5000/mcc-fred/fred/fred:$CONTAINER_TAG
refs:
- tags
script: |
# GITLAB_TOKEN is needed to create GitLab releases.
# DOCKER_* are needed to push Docker images.
docker run --rm --privileged \
-v $PWD:/go/src/gitlab.com/YourGitLabUser/YourGitLabRepo \
-w /go/src/gitlab.com/YourGitLabUser/YourGitLabRepo \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DOCKER_USERNAME -e DOCKER_PASSWORD -e DOCKER_REGISTRY \
-e GITLAB_TOKEN \
goreleaser/goreleaser release --rm-dist
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment