From 9f1ba95558b68c18a4700c8d0d4f6161df4b0ba2 Mon Sep 17 00:00:00 2001 From: Carmelo Messina Date: Sun, 26 Jan 2025 15:00:55 +0100 Subject: [PATCH] [TOOLS] Use git-chglog for changelog --- .chglog/CHANGELOG.tpl.md | 14 ++++++++++++++ .chglog/config.yml | 20 ++++++++++++++++++++ .github/workflows/release.yaml | 12 +++++------- 3 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 .chglog/CHANGELOG.tpl.md create mode 100644 .chglog/config.yml diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md new file mode 100644 index 00000000..cc5b2f8f --- /dev/null +++ b/.chglog/CHANGELOG.tpl.md @@ -0,0 +1,14 @@ +{{ 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 .Commits -}} +{{ if not (contains .Type "[") }}- {{.Hash.Short}} {{ .Subject }} +{{ if not (eq (len .Body) 0) }}{{ .Body }}{{ end }} +{{ range .Refs -}} +{{ " " }} - #{{ .Ref }} +{{ end }} +{{ end }} +{{ end }} + +{{ end -}} diff --git a/.chglog/config.yml b/.chglog/config.yml new file mode 100644 index 00000000..57bacfa6 --- /dev/null +++ b/.chglog/config.yml @@ -0,0 +1,20 @@ +style: github +template: CHANGELOG.tpl.md +info: + title: CHANGELOG + repository_url: https://github.com/uazo/cromite +options: + commits: + filters: + Type: + - "[AUTO]" + commit_groups: + # title_maps: [] + header: + pattern: "^(\\[.*\\])?(.*)$" + pattern_maps: + - Type + - Subject + notes: + keywords: + - BREAKING CHANGE diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 42d4a16b..cca96320 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,11 +17,15 @@ on: description: 'draft? [true/false]' required: true default: 'false' + comment: + description: 'comment' + required: true env: CROMITE_SHA: ${{ github.event.inputs.sha }} REMOVEDOCKERSUPPORT: true USELOCALIMAGE: true + COMMENT: ${{ github.event.inputs.comment }} jobs: release: @@ -48,9 +52,6 @@ jobs: BRANCH=$(curl https://github.com/uazo/cromite/branch_commits/$CROMITE_SHA | ./pup -p li.branch:last-child a text{} | xargs) echo "BRANCH=$BRANCH" >> $GITHUB_ENV - wget https://github.com/cli/cli/releases/download/v2.18.1/gh_2.18.1_linux_amd64.tar.gz - tar xfz gh_2.18.1_linux_amd64.tar.gz - - name: Checkout 'uazo/cromite' uses: actions/checkout@v2 with: @@ -71,10 +72,7 @@ jobs: echo ${{ secrets.GITHUB_TOKEN }} | $GH auth login --with-token - echo "\`\`\`" >note - # echo "this is not the official release of bromite but a test version." >>note - # echo "you can try it at your own risk." >>note - echo "\`\`\`" >>note + echo $COMMENT >note $GH release create $VERSION-$CROMITE_SHA --notes-file note -d