From 358a2688e330697fd334e73853e6ed19382df293 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 18 Dec 2022 16:03:26 +0100 Subject: [PATCH] ci: add release pipeline --- .chglog/CHANGELOG.tpl.md | 23 +++++++++++++++ .chglog/config.yml | 25 ++++++++++++++++ .drone.yml | 61 ++++++++++++++++++++++++++++++++++++++-- 3 files changed, 106 insertions(+), 3 deletions(-) create mode 100755 .chglog/CHANGELOG.tpl.md create mode 100755 .chglog/config.yml diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md new file mode 100755 index 0000000..cc0367b --- /dev/null +++ b/.chglog/CHANGELOG.tpl.md @@ -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 -}} diff --git a/.chglog/config.yml b/.chglog/config.yml new file mode 100755 index 0000000..c7478ba --- /dev/null +++ b/.chglog/config.yml @@ -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 diff --git a/.drone.yml b/.drone.yml index c9ba5c6..d582c7e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,6 +1,6 @@ --- kind: pipeline -name: check +name: test platform: os: linux @@ -13,13 +13,18 @@ steps: commands: - 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 pull: always image: jmccann/drone-terraform:8 settings: actions: - validate - tf_version: 1.2.0 + tf_version: 1.3.0 node: zone: mgmt @@ -30,8 +35,58 @@ trigger: - refs/tags/** - 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} + depends_on: + - tags + + - name: changelog-format + image: thegeeklab/alpine-tools + commands: + - prettier CHANGELOG.md + - prettier -w CHANGELOG.md + depends_on: + - changelog-generate + + - 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/** + depends_on: + - publish-dockerhub + - publish-quay + +trigger: + ref: + - refs/heads/main + - refs/pull/** + - refs/tags/** + +depends_on: + - test + --- kind: signature -hmac: ec825d5879e3dc1d26bdc619143cf2ea41d5183c2d7b892498b21103379675c2 +hmac: 8811fe550ab6c86d00c61525cfb9decaf56d324633c3a7171057d2f12cf5b86d ...