feat: automate releases using goreleaser
This commit is contained in:
parent
baa157fc06
commit
e599570220
@ -1,19 +1,11 @@
|
|||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
- build
|
- build
|
||||||
|
- release
|
||||||
|
|
||||||
.go_template:
|
.go_template:
|
||||||
image: golang:latest
|
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:
|
dependencies:
|
||||||
extends: .go_template
|
extends: .go_template
|
||||||
stage: test
|
stage: test
|
||||||
@ -42,36 +34,25 @@ build:
|
|||||||
- fail2ban_exporter
|
- fail2ban_exporter
|
||||||
expire_in: 1 day
|
expire_in: 1 day
|
||||||
|
|
||||||
# build:
|
release:
|
||||||
# extends: .go_template
|
stage: release
|
||||||
# stage: build
|
image: docker:stable
|
||||||
# only:
|
services:
|
||||||
# - main
|
- docker:dind
|
||||||
# - tags
|
variables:
|
||||||
# script:
|
DOCKER_REGISTRY: $CI_REGISTRY
|
||||||
# - git fetch --tags
|
DOCKER_USERNAME: $CI_REGISTRY_USER
|
||||||
# - make build/snapshot
|
DOCKER_PASSWORD: $CI_REGISTRY_PASSWORD
|
||||||
# artifacts:
|
GIT_DEPTH: 0
|
||||||
# paths:
|
rules:
|
||||||
# - dist/*.tar.gz
|
- if: $CI_COMMIT_TAG =~ /^v.*$/
|
||||||
# - dist/checksums.txt
|
script: |
|
||||||
# expire_in: 1 day
|
# GITLAB_TOKEN is needed to create GitLab releases.
|
||||||
|
# DOCKER_* are needed to push Docker images.
|
||||||
# docker/gitlab:
|
docker run --rm --privileged \
|
||||||
# extends: .docker_template
|
-v $PWD:/go/src/gitlab.com/hectorjsmith/fail2ban-prometheus-exporter \
|
||||||
# stage: build
|
-w /go/src/gitlab.com/hectorjsmith/fail2ban-prometheus-exporter \
|
||||||
# only:
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
# - tags
|
-e DOCKER_USERNAME -e DOCKER_PASSWORD -e DOCKER_REGISTRY \
|
||||||
# script:
|
-e GITLAB_TOKEN \
|
||||||
# - make docker/build/latest
|
goreleaser/goreleaser release --clean
|
||||||
# - 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
|
|
||||||
|
@ -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
|
project_name: fail2ban_exporter
|
||||||
before:
|
|
||||||
hooks:
|
|
||||||
- make go/dependencies
|
|
||||||
builds:
|
builds:
|
||||||
-
|
-
|
||||||
binary: fail2ban_exporter
|
binary: fail2ban_exporter
|
||||||
dir: src
|
|
||||||
goos:
|
goos:
|
||||||
- linux
|
- linux
|
||||||
- darwin
|
- darwin
|
||||||
@ -20,14 +14,32 @@ builds:
|
|||||||
- "6"
|
- "6"
|
||||||
- "7"
|
- "7"
|
||||||
|
|
||||||
archives:
|
dockers:
|
||||||
-
|
- image_templates: ["registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Version }}"]
|
||||||
wrap_in_directory: true
|
dockerfile: Dockerfile
|
||||||
files:
|
build_flag_templates:
|
||||||
- LICENSE
|
- --label=org.opencontainers.image.title={{ .ProjectName }}
|
||||||
- README.md
|
- --label=org.opencontainers.image.description={{ .ProjectName }}
|
||||||
- CHANGELOG.md
|
- --label=org.opencontainers.image.url=https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter
|
||||||
checksum:
|
- --label=org.opencontainers.image.source=https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter
|
||||||
name_template: 'checksums.txt'
|
- --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:
|
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 New Issue
Block a user