fail2ban-prometheus-exporter/.gitlab-ci.yml
Hector 05f236902a ci: update creation of tags (#19)
Update creation of docker tags to only tag actual releases with the
`:latest` tag. Builds on the main branch are now tagged with a `:nightly`
tag.
2022-02-12 17:31:01 +00:00

69 lines
1.2 KiB
YAML

stages:
- test
- build
.go_template:
image: golang:latest
before_script:
- make go/dependencies
.docker_template:
image: docker:stable
services:
- docker:dind
before_script:
- apk add git
- apk add make
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
dependencies:
extends: .go_template
stage: test
script:
- make go/checkDependencies
format:
extends: .go_template
stage: test
script:
- make go/checkFmt
test:
extends: .go_template
stage: test
script:
- make go/test
build:
extends: .go_template
stage: build
only:
- main
- tags
script:
- git fetch --tags
- make build/snapshot
artifacts:
paths:
- dist/*.tar.gz
- dist/checksums.txt
expire_in: 1 day
docker/gitlab:
extends: .docker_template
stage: build
only:
- tags
script:
- make docker/build/latest
- make docker/build/tag
- docker push registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter
docker/gitlab/nightly:
extends: .docker_template
stage: build
only:
- main
script:
- make docker/build/nightly
- docker push registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter