Merge branch 'feat/automate-releases-using-goreleaser' into 'main'
feat: automate releases using goreleaser See merge request hectorjsmith/fail2ban-prometheus-exporter!81
This commit is contained in:
commit
17e5a3835b
2 changed files with 51 additions and 58 deletions
|
@ -1,19 +1,11 @@
|
|||
stages:
|
||||
- test
|
||||
- build
|
||||
- release
|
||||
|
||||
.go_template:
|
||||
image: golang:latest
|
||||
|
||||
# .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
|
||||
|
@ -42,36 +34,25 @@ build:
|
|||
- fail2ban_exporter
|
||||
expire_in: 1 day
|
||||
|
||||
# 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
|
||||
release:
|
||||
stage: release
|
||||
image: docker:stable
|
||||
services:
|
||||
- docker:dind
|
||||
variables:
|
||||
DOCKER_REGISTRY: $CI_REGISTRY
|
||||
DOCKER_USERNAME: $CI_REGISTRY_USER
|
||||
DOCKER_PASSWORD: $CI_REGISTRY_PASSWORD
|
||||
GIT_DEPTH: 0
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG =~ /^v.*$/
|
||||
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/hectorjsmith/fail2ban-prometheus-exporter \
|
||||
-w /go/src/gitlab.com/hectorjsmith/fail2ban-prometheus-exporter \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-e DOCKER_USERNAME -e DOCKER_PASSWORD -e DOCKER_REGISTRY \
|
||||
-e GITLAB_TOKEN \
|
||||
goreleaser/goreleaser release --clean
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
# This is an example goreleaser.yaml file with some sane defaults.
|
||||
# Make sure to check the documentation at http://goreleaser.com
|
||||
project_name: fail2ban_exporter
|
||||
before:
|
||||
hooks:
|
||||
- make go/dependencies
|
||||
builds:
|
||||
-
|
||||
binary: fail2ban_exporter
|
||||
dir: src
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
|
@ -20,14 +14,32 @@ builds:
|
|||
- "6"
|
||||
- "7"
|
||||
|
||||
archives:
|
||||
-
|
||||
wrap_in_directory: true
|
||||
files:
|
||||
- LICENSE
|
||||
- README.md
|
||||
- CHANGELOG.md
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
dockers:
|
||||
- image_templates: ["registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Version }}"]
|
||||
dockerfile: Dockerfile
|
||||
build_flag_templates:
|
||||
- --label=org.opencontainers.image.title={{ .ProjectName }}
|
||||
- --label=org.opencontainers.image.description={{ .ProjectName }}
|
||||
- --label=org.opencontainers.image.url=https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter
|
||||
- --label=org.opencontainers.image.source=https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter
|
||||
- --label=org.opencontainers.image.version={{ .Version }}
|
||||
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
|
||||
- --label=org.opencontainers.image.revision={{ .FullCommit }}
|
||||
- --label=org.opencontainers.image.licenses=MIT
|
||||
|
||||
changelog:
|
||||
skip: true
|
||||
groups:
|
||||
- title: "⛔ Breaking Changes"
|
||||
regexp: '^.*?!:.+$'
|
||||
order: 0
|
||||
- title: "🎉 Features"
|
||||
regexp: '^.*?feat(\(\w+\))??:.+$'
|
||||
order: 1
|
||||
- title: "🐛 Fixes"
|
||||
regexp: '^.*?fix(\(\w+\))??:.+$'
|
||||
order: 2
|
||||
- title: "📑 Other"
|
||||
order: 999
|
||||
filters:
|
||||
exclude:
|
||||
- "^Merge"
|
||||
|
|
Loading…
Reference in a new issue