ci: add release pipeline (#2)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
Robert Kaussow 2022-12-18 16:23:07 +01:00
parent 60f70d3fd8
commit 5dec723779
5 changed files with 119 additions and 3 deletions

23
.chglog/CHANGELOG.tpl.md Executable file
View File

@ -0,0 +1,23 @@
# Changelog
{{ range .Versions -}}
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ (regexReplaceAll "(.*)/issues/(.*)" (regexReplaceAll "(Co-\\w*-by.*)" .Subject "") "${1}/pulls/${2}") | trim }}
{{ end }}
{{- end -}}
{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

25
.chglog/config.yml Executable file
View File

@ -0,0 +1,25 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://gitea.rknet.org/infra/hcloud-server-tf
options:
commit_groups:
title_maps:
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
chore: Others
test: Testing
ci: CI Pipeline
docs: Documentation
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE

View File

@ -1,6 +1,6 @@
--- ---
kind: pipeline kind: pipeline
name: check name: test
platform: platform:
os: linux os: linux
@ -13,13 +13,18 @@ steps:
commands: commands:
- git diff-tree --check $(git hash-object -t tree /dev/null) HEAD - git diff-tree --check $(git hash-object -t tree /dev/null) HEAD
- name: tflint
image: ghcr.io/terraform-linters/tflint
commands:
- tflint --color
- name: terraform - name: terraform
pull: always pull: always
image: jmccann/drone-terraform:8 image: jmccann/drone-terraform:8
settings: settings:
actions: actions:
- validate - validate
tf_version: 1.2.0 tf_version: 1.3.0
node: node:
zone: mgmt zone: mgmt
@ -30,8 +35,54 @@ trigger:
- refs/tags/** - refs/tags/**
- refs/pull/** - refs/pull/**
---
kind: pipeline
name: release
platform:
os: linux
arch: amd64
steps:
- name: changelog-generate
image: thegeeklab/git-chglog
commands:
- git fetch -tq
- git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}
- name: changelog-format
image: thegeeklab/alpine-tools
commands:
- prettier CHANGELOG.md
- prettier -w CHANGELOG.md
- name: publish-gitea
image: plugins/gitea-release
settings:
api_key:
from_secret: gitea_token
base_url: https://gitea.rknet.org
note: CHANGELOG.md
overwrite: true
title: ${DRONE_TAG}
when:
ref:
- refs/tags/**
node:
zone: mgmt
trigger:
ref:
- refs/heads/main
- refs/pull/**
- refs/tags/**
depends_on:
- test
--- ---
kind: signature kind: signature
hmac: ec825d5879e3dc1d26bdc619143cf2ea41d5183c2d7b892498b21103379675c2 hmac: 08a182381788120a9debba89ce838da455d72b0057be6bd1b84ae3437eb1106d
... ...

16
.tflint.hcl Normal file
View File

@ -0,0 +1,16 @@
plugin "terraform" {
enabled = true
preset = "recommended"
}
rule "terraform_required_version" {
enabled = false
}
rule "terraform_required_providers" {
enabled = false
}
rule "terraform_unused_declarations" {
enabled = false
}

View File

@ -39,6 +39,7 @@ variable "ucs_zones" {
// Module // Module
variable "server" { variable "server" {
type = list(any)
default = [] default = []
} }