Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add a Changelog #58

Draft
wants to merge 27 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9f33367
add a changelog
bdashrad Nov 19, 2021
05c89fe
remove testing for deprecated k8s version 1.19
bdashrad Nov 19, 2021
886095d
auto generate changelog
bdashrad Nov 22, 2021
1b869f9
feat: comment changelog output
bdashrad Nov 22, 2021
5824d3e
fix broken changelog action
bdashrad Nov 22, 2021
88a3774
update action version
bdashrad Nov 22, 2021
61c60ba
use value of output
bdashrad Nov 22, 2021
1374021
multiline yaml
bdashrad Nov 22, 2021
30383d9
bump version for fix
bdashrad Nov 22, 2021
bf60e41
Merge branch 'master' into changelog
bdashrad Mar 2, 2022
327e680
use yq to get chart version
bdashrad Mar 2, 2022
90b97e9
fix chart path
bdashrad Mar 2, 2022
316b7cf
feat: add changelog
bdashrad Mar 2, 2022
5faa9de
with changelog, go to 1.0.0 release
bdashrad Mar 2, 2022
9d131a7
yamllint
bdashrad Mar 2, 2022
8abdeac
fix changelog version tag
bdashrad Mar 2, 2022
d11dad8
add action to lint PR titles for matching conventional commits spec
bdashrad Mar 2, 2022
e675e65
run on PRs in repo org too
bdashrad Mar 2, 2022
79e3765
generate and commit changelog on merge to main
bdashrad Mar 4, 2022
8b71414
add changelog to release description
bdashrad Mar 4, 2022
49b10c1
update commenter action and changelog diff
bdashrad Mar 7, 2022
0912b8d
Merge remote-tracking branch 'origin/master' into changelog
bdashrad Mar 7, 2022
499b56a
update CHANGELOG.md
bdashrad Mar 7, 2022
77223e7
only show new changes above preview
bdashrad Mar 7, 2022
fec8c34
need leading space for code block
bdashrad Mar 7, 2022
454320f
Merge branch 'master' into changelog
bdashrad Mar 14, 2022
8411c22
Merge remote-tracking branch 'origin/master' into changelog
bdashrad Mar 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

{{ if .Versions -}}
<a name="unreleased"></a>
## [Unreleased]

{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts
{{ range .RevertCommits -}}
- {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .MergeCommits -}}
### Pull Requests
{{ range .MergeCommits -}}
- {{ .Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{- if .Versions }}
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}

_______________________

CHANGELOG.md is generated with [git-chlog](https://github.com/git-chglog/git-chglog)
28 changes: 28 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/PrivateBin/helm-chart
options:
commits:
# filters:
# Type:
# - feat
# - fix
# - perf
# - refactor
commit_groups:
# title_maps:
# feat: Features
# fix: Bug Fixes
# perf: Performance Improvements
# refactor: Code Refactoring
header:
pattern: "^(\\w*)\\:\\s(.*)$"
pattern_maps:
- Type
- Subject
notes:
keywords:
- BREAKING CHANGE
57 changes: 57 additions & 0 deletions .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
name: Create changelog
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

jobs:
generate_changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get chart version
id: get_chart_version
uses: mikefarah/yq@v4.21.1
with:
cmd: yq '.version' 'charts/privatebin/Chart.yaml'
- name: Generate PR changelog
id: gen_pr_changelog
uses: bdashrad/git-chglog-action@v2.0.3
with:
next_version: privatebin-${{ steps.get_chart_version.outputs.result }}
tag: privatebin-${{ steps.get_chart_version.outputs.result }}
- name: Generate full changelog
id: gen_changelog
uses: bdashrad/git-chglog-action@v2.0.3
with:
next_version: privatebin-${{ steps.get_chart_version.outputs.result }}
filename: CHANGELOG.md
- name: Diff CHANGELOG.md
id: diff_changelog
run: scripts/diff-changelog.sh
- name: Comment PR
uses: mshick/add-pr-comment@v1
with:
message: |
${{ steps.gen_pr_changelog.outputs.changelog }}
<details>
<summary>Full Changelog diff (Click to Expand)</summary>

```diff
${{ steps.diff_changelog.outputs.diff }}
```
</details>
allow-repeats: false
repo-token: ${{ secrets.GITHUB_TOKEN }}
if: |
github.event_name == 'pull_request' &&
steps.gen_changelog.outputs.changelog != ''
22 changes: 22 additions & 0 deletions .github/workflows/lint-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: "Lint PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize
pull_request:

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
validateSingleCommit: true
validateSingleCommitMatchesPrTitle: true
46 changes: 46 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,32 @@ on:
- master

jobs:
changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get chart version
id: get_chart_version
uses: mikefarah/yq@v4.21.1
with:
cmd: yq '.version' 'charts/privatebin/Chart.yaml'
- name: Generate changelog
id: gen_changelog
uses: bdashrad/git-chglog-action@v2.0.3
with:
next_version: privatebin-${{ steps.get_chart_version.outputs.result }}
filename: CHANGELOG.md
- name: Commit CHANGELOG.md
uses: EndBug/add-and-commit@v8
with:
add: CHANGELOG.md
default_author: github_actor
message: 'Update CHANGELOG.md for version ${{ steps.get_chart_version.outputs.result }}'
push: true

release:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -41,3 +67,23 @@ jobs:
charts_dir: charts
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: Get chart version
id: get_chart_version
uses: mikefarah/yq@v4.21.1
with:
cmd: yq '.version' 'charts/privatebin/Chart.yaml'

- name: Generate changelog for release
id: gen_changelog
uses: bdashrad/git-chglog-action@v2.0.3
with:
tag: privatebin-${{ steps.get_chart_version.outputs.result }}

- name: Update Release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
body: ${{ steps.changelog_reader.outputs.changes }}
tag: ${{matrix.tag}}
token: ${{ secrets.GITHUB_TOKEN }}
Loading