From d94de07909d0e528447d662a0d14a3be2a25490a Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Fri, 12 Feb 2021 10:28:31 +0100 Subject: [PATCH] ci: add automatic changelog generation (#16) --- .chglog/config.yml | 4 ++-- .drone.star | 36 ++++++++++++++++++++++++++---------- .gitignore | 1 + CHANGELOG.md | 12 ------------ 4 files changed, 29 insertions(+), 24 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/.chglog/config.yml b/.chglog/config.yml index 3562536..c86684b 100755 --- a/.chglog/config.yml +++ b/.chglog/config.yml @@ -11,9 +11,9 @@ options: perf: Performance Improvements refactor: Code Refactoring chore: Others - docs: Documentation - ci: CI Pipeline test: Testing + ci: CI Pipeline + docs: Documentation header: pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$" pattern_maps: diff --git a/.drone.star b/.drone.star index 82ff2aa..57e9291 100644 --- a/.drone.star +++ b/.drone.star @@ -259,16 +259,30 @@ def release(ctx): "name": "release", "steps": [ { - "name": "release", - "image": "plugins/github-release", - "settings": { - "api_key": { - "from_secret": "github_token", - }, - "note": "CHANGELOG.md", - "overwrite": True, - "title": ctx.build.ref.replace("refs/tags/", ""), - }, + "name": "changelog", + "image": "thegeeklab/git-chglog", + "commands": [ + "git fetch -tq", + "git-chglog --no-color --no-emoji %s" % (ctx.build.ref.replace("refs/tags/v", "") if ctx.build.event == "tag" else "--next-tag unreleased unreleased"), + "git-chglog --no-color --no-emoji -o CHANGELOG.md %s" % (ctx.build.ref.replace("refs/tags/v", "") if ctx.build.event == "tag" else "--next-tag unreleased unreleased"), + ] + }, + { + "name": "release", + "image": "plugins/github-release", + "settings": { + "api_key": { + "from_secret": "github_token", + }, + "note": "CHANGELOG.md", + "overwrite": True, + "title": ctx.build.ref.replace("refs/tags/", ""), + }, + "when": { + "ref": [ + "refs/tags/**", + ], + }, } ], "depends_on": [ @@ -276,7 +290,9 @@ def release(ctx): ], "trigger": { "ref": [ + "refs/heads/master", "refs/tags/**", + "refs/pull/**", ], }, }] diff --git a/.gitignore b/.gitignore index 32d7142..7e53e2f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ coverage.out .drone.yml +CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 042baca..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,12 +0,0 @@ -# Changelog - -## [v2.10.4](https://github.com/owncloud-ci/drone-ansible/compare/v2.10.3...v2.10.4) (2021-02-10) - -### Code Refactoring - -- rewrite to use plugin boilerplate ([#12](https://github.com/owncloud-ci/drone-ansible/issues/12)) - -### Others - -- **deps:** update dependency ansible to v2.10.7 ([#11](https://github.com/owncloud-ci/drone-ansible/issues/11)) -